Template_Modifications::autodetect_facebook_video_preview( WP_Post $event )
Add a preview video of Facebook video to autodetect.
Contents
Parameters
- $event
-
(WP_Post) (Required) The event post object, as decorated by the
tribe_get_eventfunction.
Return
(string) The video player html, missing FB app id message, or an empty string.
Source
File: src/Tribe/Meetings/Facebook/Template_Modifications.php
public function autodetect_facebook_video_preview( $event ) {
if ( Facebook_Meta::$autodetect_fb_video_id !== $event->virtual_autodetect_source ) {
return '';
}
// If no app id return no Facebook App ID message.
if( ! tribe_get_option( $this->settings->get_prefix( 'app_id' ), '' ) ) {
$no_msg_fields = $this->api->get_no_facebook_app_id_message_content();
// Unset the dependency fields as we are reusing template data.
unset( $no_msg_fields['field']['classes_wrap'][0] );
unset( $no_msg_fields['field']['wrap_attrs'] );
return $this->admin_template->template( $no_msg_fields['path'], $no_msg_fields['field'] );
}
// Set for the preview video to always show in the admin.
$event->virtual_embed_video = $event->virtual_should_show_embed = true;
return $this->template->template( 'facebook/single/facebook-video-embed', [ 'event' => $event ] );
}
Changelog
| Version | Description |
|---|---|
| 1.8.0 | Introduced. |