Event_Meta::attach_rest_properties( TribeEventsVirtualMeetingsFacebookarray $data, WP_Post $event )
Add information about the Facebook live stream if available via the REST Api.
Contents
Parameters
- $data
-
(<span class="TribeEventsVirtualMeetingsFacebookarray">TribeEventsVirtualMeetingsFacebookarray) (Required) The current data of the event.
- $event
-
(WP_Post) (Required) The event being updated.
Return
(TribeEventsVirtualMeetingsFacebookarray<string,mixed>) An array with the data of the event on the endpoint.
Source
File: src/Tribe/Meetings/Facebook/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 Facebook is not the source.
if ( 'facebook' !== $event->virtual_video_source ) {
return $data;
}
if ( empty( $data['meetings'] ) ) {
$data['meetings'] = [];
}
$data['meetings']['facebook'] = [
'local_id' => $event->facebook_local_id,
'is_live' => $event->virtual_meeting_is_live,
];
return $data;
}
Changelog
| Version | Description |
|---|---|
| 1.7.0 | Introduced. |