Event_Meta::attach_rest_properties( TribeEventsVirtualMeetingsYouTubearray $data, WP_Post $event )

Add information about the YouTube live stream if available via the REST Api.


Parameters

$data

(<span class="TribeEventsVirtualMeetingsYouTubearray">TribeEventsVirtualMeetingsYouTubearray) (Required) The current data of the event.

$event

(WP_Post) (Required) The event being updated.


Top ↑

Return

(TribeEventsVirtualMeetingsYouTubearray<string,mixed>) An array with the data of the event on the endpoint.


Top ↑

Source

File: src/Tribe/Meetings/YouTube/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 YouTube is not the source.
		if ( 'youtube' !== $event->virtual_video_source ) {
			return $data;
		}

		if ( empty( $data['meetings'] ) ) {
			$data['meetings'] = [];
		}

		$data['meetings']['youtube'] = [
			'channel_id'      => $event->youtube_channel_id,
			'is_live'         => $event->virtual_meeting_is_live,
			'auto_play'       => $event->youtube_autoplay,
			'live_chat'       => $event->youtube_live_chat,
			'mute_video'      => $event->youtube_mute_video,
			'modest_branding' => $event->youtube_modest_branding,
			'related_videos'  => $event->youtube_related_videos,
			'hide_controls'   => $event->youtube_hide_controls,
		];

		return $data;
	}

Top ↑

Changelog

Changelog
Version Description
1.6.0 Introduced.