Tribe__Tickets__Commerce__PayPal__Main::do_metabox_capacity_options( int $post_id, int $ticket_id )
Renders the advanced fields in the new/edit ticket form.
Contents
Using the method, providers can add as many fields as they want, specific to their implementation.
Parameters
- $post_id
-
(int) (Required)
- $ticket_id
-
(int) (Required)
Return
(mixed)
Source
File: src/Tribe/Commerce/PayPal/Main.php
public function do_metabox_capacity_options( $post_id, $ticket_id ) {
$is_correct_provider = tribe( 'tickets.handler' )->is_correct_provider( $post_id, $this );
$url = '';
$stock = '';
$global_stock_mode = tribe( 'tickets.handler' )->get_default_capacity_mode();
$global_stock_cap = 0;
$ticket_capacity = null;
$post_capacity = null;
$stock_object = new Tribe__Tickets__Global_Stock( $post_id );
if ( $stock_object->is_enabled() ) {
$post_capacity = tribe_tickets_get_capacity( $post_id );
}
if ( ! empty( $ticket_id ) ) {
$ticket = $this->get_ticket( $post_id, $ticket_id );
$is_correct_provider = tribe( 'tickets.handler' )->is_correct_provider( $ticket_id, $this );
if ( ! empty( $ticket ) ) {
$stock = $ticket->managing_stock() ? $ticket->stock() : '';
$ticket_capacity = tribe_tickets_get_capacity( $ticket->ID );
$global_stock_mode = ( method_exists( $ticket, 'global_stock_mode' ) ) ? $ticket->global_stock_mode() : '';
$global_stock_cap = ( method_exists( $ticket, 'global_stock_cap' ) ) ? $ticket->global_stock_cap() : 0;
}
}
// Bail when we are not dealing with this provider
if ( ! $is_correct_provider ) {
return;
}
$file = Tribe__Tickets__Main::instance()->plugin_path . 'src/admin-views/tpp-metabox-capacity.php';
/**
* Filters the absolute path to the file containing the metabox capacity HTML.
*
* @since 4.7
*
* @param string $file The absolute path to the file containing the metabox capacity HTML
* @param int|string $ticket_capacity
* @param int|string $post_capacity
*/
$file = apply_filters( 'tribe_tickets_tpp_metabox_capacity_file', $file, $ticket_capacity, $post_capacity );
if ( file_exists( $file ) ) {
include $file;
}
}
Changelog
| Version | Description |
|---|---|
| 4.7 | Introduced. |