Event_Meta::add_event_properties( WP_Post $event )

Adds YouTube related properties to an event post object.


Parameters

$event

(WP_Post) (Required) The event post object, as decorated by the tribe_get_event function.


Top ↑

Return

(WP_Post) The decorated event post object, with YouTube related properties added to it.


Top ↑

Source

File: src/Tribe/Meetings/YouTube/Event_Meta.php

	public static function add_event_properties( \WP_Post $event ) {
		// Return when YouTube is not the source.
		if ( 'youtube' !== $event->virtual_video_source ) {
			return $event;
		}

		// Get the saved values since the source is YouTube.
		foreach ( self::$fields as $field_name ) {
			$prefix_name = self::get_prefix( $field_name );
			$value = self::get_meta_field( $prefix_name, $event );
			$event->{$prefix_name} = $value;
		}

		// Enforce this is a virtual event.
		$event->virtual                  = true;
		$event->virtual_meeting          = true;
		$event->virtual_meeting_provider = tribe( YouTube_Provider::class )->get_slug();

		// Set virtual url to null if YouTube is connected to the event.
		$event->virtual_url = null;

		return $event;
	}

Top ↑

Changelog

Changelog
Version Description
1.6.0 Introduced.