Tribe__Tickets__Editor__Blocks__Rsvp::get_tickets( $post_id )
Method to get all RSVP tickets
Return
(array)
Source
File: src/Tribe/Editor/Blocks/Rsvp.php
public function get_tickets( $post_id ) {
$tickets = [];
// Bail if there's no event id
if ( ! $post_id ) {
return $tickets;
}
/** @var Tribe__Tickets__RSVP $rsvp */
$rsvp = tribe( 'tickets.rsvp' );
// Get the tickets IDs for this event
$ticket_ids = $rsvp->get_tickets_ids( $post_id );
// Bail if we don't have tickets
if ( ! $ticket_ids ) {
return $tickets;
}
// We only want RSVP tickets.
foreach ( $ticket_ids as $post ) {
// Get the ticket
$ticket = $rsvp->get_ticket( $post_id, $post );
if (
! $ticket instanceof Tribe__Tickets__Ticket_Object
|| $rsvp->class_name !== $ticket->provider_class
) {
continue;
}
$tickets[] = $ticket;
}
return $tickets;
}
Changelog
| Version | Description |
|---|---|
| 4.9 | Introduced. |