Tribe__Tickets__REST__V1__Ticket_Repository::format_item( int|WP_Post $id )
Returns the ticket in the REST API format.
Contents
Parameters
- $id
-
(int|WP_Post) (Required)
Return
(array|null) The ticket information in the REST API format or null if the ticket is invalid.
Source
File: src/Tribe/REST/V1/Ticket_Repository.php
public function format_item( $id ) {
/**
* For the time being we use **another** repository to format
* the tickets objects to the REST API format.
* If this implementation gets a thumbs-up this class and the
* `Tribe__Tickets__REST__V1__Post_Repository` should be merged.
*/
/** @var Tribe__Tickets__REST__V1__Post_Repository $repository */
$repository = tribe( 'tickets.rest-v1.repository' );
$formatted = $repository->get_ticket_data( $id );
return $formatted instanceof WP_Error ? null : $formatted;
}
Changelog
| Version | Description |
|---|---|
| 4.8 | Introduced. |