Tribe__Tickets__Metabox::get_panels( int|WP_Post $post, int|null $ticket_id = null, string|null $ticket_type = null )
Get the Panels for a given post.
Contents
Parameters
- $post
-
(int|WP_Post) (Required) The post object or ID the tickets are for.
- $ticket_id
-
(int|null) (Optional) The ID of the ticket to render the panels for, or
nullif rendering for a new ticket.Default value: null
- $ticket_type
-
(string|null) (Optional) The ticket type to render the panels for.
Default value: null
Return
(array<string,string>) A map from panel name to panel HTML content.
Source
File: src/Tribe/Metabox.php
public function get_panels( $post, $ticket_id = null ) {
if ( ! $post instanceof WP_Post ) {
$post = get_post( $post );
}
// Bail on Invalid post
if ( ! $post instanceof WP_Post ) {
return array();
}
// Overwrites for a few templates that use get_the_ID() and get_post()
$GLOBALS['post'] = $post;
// Let's create tickets list markup to return
$tickets = Tribe__Tickets__Tickets::get_event_tickets( $post->ID );
$panels = array(
'list' => tribe( 'tickets.admin.views' )->template( 'editor/panel/list', array( 'post_id' => $post->ID, 'tickets' => $tickets ), false ),
'settings' => tribe( 'tickets.admin.views' )->template( 'editor/panel/settings', array( 'post_id' => $post->ID ), false ),
'ticket' => tribe( 'tickets.admin.views' )->template( 'editor/panel/ticket', array( 'post_id' => $post->ID, 'ticket_id' => $ticket_id ), false ),
);
return $panels;
}
Changelog
| Version | Description |
|---|---|
| 4.6.2 | Introduced. |