Abstract_Event_Meta::attach_rest_properties( TribeEventsVirtualIntegrationsarray $data, WP_Post $event )
Add information about the API if available, only if the user has permission to read_private_posts via the REST Api.
Contents
Parameters
- $data
-
(<span class="TribeEventsVirtualIntegrationsarray">TribeEventsVirtualIntegrationsarray) (Required) The current data of the event.
- $event
-
(WP_Post) (Required) The event being updated.
Return
(TribeEventsVirtualIntegrationsarray<string,mixed>) An array with the data of the event on the endpoint.
Source
File: src/Tribe/Integrations/Abstract_Event_Meta.php
public function attach_rest_properties( array $data, WP_Post $event ) {
$event = tribe_get_event( $event );
if ( ! $event instanceof WP_Post || ! current_user_can( 'read_private_posts' ) ) {
return $data;
}
// Return when API is not the source.
if ( static::$key_source_id !== $event->virtual_video_source ) {
return $data;
}
if ( empty( $data['meetings'] ) ) {
$data['meetings'] = [];
}
if ( ! $event->virtual || empty( $this->get_meeting_id( $event ) ) ) {
return $data;
}
$data['meetings'][static::$key_source_id] = $this->get_meeting_data_for_rest_api( $event );
return $data;
}
Changelog
| Version | Description |
|---|---|
| 1.11.0 | Introduced. |