Tribe__Tickets__Editor::get_tickets_as_blocks( $post_id )
Return an array with all the tickets as a group of items in an array as strings as blocks formats ready to be inserted into the post_content of a post
Contents
Parameters
- $post_id
-
(Required)
Return
(array)
Source
File: src/Tribe/Editor.php
public function get_tickets_as_blocks( $post_id ) {
$tickets = Tribe__Tickets__Tickets::get_all_event_tickets( $post_id );
$blocks[] = '<!-- wp:tribe/tickets --><div class="wp-block-tribe-tickets">';
foreach ( $tickets as $key => $ticket ) {
// Skip RSVP items
if ( 'Tribe__Tickets__RSVP' === $ticket->provider_class ) {
continue;
}
// Insert into the replace a single Child ticket
$blocks[] = '<!-- wp:tribe/tickets-item {"hasBeenCreated":true,"ticketId":' . $ticket->ID . '} --><div class="wp-block-tribe-tickets-item"></div><!-- /wp:tribe/tickets-item -->';
}
$blocks[] = '</div><!-- /wp:tribe/tickets -->';
return $blocks;
}
Changelog
| Version | Description |
|---|---|
| 4.9.2 | Introduced. |