Template_Modifications::add_facebook_video_embed()

Adds Facebook video embed to a single event.


Return

(string) The embed html or empty string when it should not display.


Top ↑

Source

File: src/Tribe/Meetings/Facebook/Template_Modifications.php

	public function add_facebook_video_embed() {
		// Don't show on password protected posts.
		if ( post_password_required() ) {
			return;
		}

		$event = tribe_get_event( get_the_ID() );
		if ( ! $event instanceof \WP_Post ) {
			return;
		}

		// Only embed when the source is video.
		if (
			! isset( $event->virtual_video_source ) ||
			'facebook' !== $event->virtual_video_source
		) {
			return;
		}

		// Hide on a past event.
		if ( tribe_is_past_event( $event ) ) {
			return;
		}

		// Don't show if requires log in and user isn't logged in.
		if ( ! $this->base_modifications->should_show_virtual_content( $event ) ) {
			return;
		}

		if (
			! $event->virtual_embed_video ||
			! $event->virtual_should_show_embed
		) {
			return;
		}

		if ( ! $event->virtual_meeting_is_live ) {
			$context = [
				'event'         => $event,
				'offline'           => esc_html_x(
					'The Live Stream is Offline.',
					'Facebook offline message',
					'events-virtual'
				),
			];
			$this->template->template( 'facebook/single/facebook-embed-offline', $context );

			return;
		}

		if ( ! $event->virtual_meeting_embed ) {
			return;
		}

		$context = [
			'event'         => $event,
			'embed_classes' => [],
			'embed'         => $event->virtual_meeting_embed,
		];

		$this->template->template( 'facebook/single/facebook-embed', $context );
	}

Top ↑

Changelog

Changelog
Version Description
1.7.0 Introduced.