Classic_Editor::render_setup_options( null|WP_Post|int $post = null, bool $echo = true )
Renders, echoing to the page, the Facebook Integration fields.
Contents
Parameters
- $post
-
(null|WP_Post|int) (Optional) The post object or ID of the event to generate the controls for, or
nullto use the global post object.Default value: null
- $echo
-
(bool) (Optional) Whether to echo the template contents to the page (default) or to return it.
Default value: true
Return
(string) The template contents, if not rendered to the page.
Source
File: src/Tribe/Meetings/Facebook/Classic_Editor.php
public function render_setup_options( $post = null, $echo = true ) {
$post = tribe_get_event( get_post( $post ) );
if ( ! $post instanceof \WP_Post ) {
return '';
}
// Make sure to apply the Facebook properties to the event.
Facebook_Meta::add_event_properties( $post );
// Get the current Facebook Pages
$pages = $this->page_api->get_formatted_page_list( true, $post->facebook_local_id );
if ( empty( $pages ) ) {
return $this->render_incomplete_setup();
}
return $this->template->template(
'virtual-metabox/facebook/controls',
[
'event' => $post,
'pages' => [
'label' => _x(
'Choose Page:',
'The label of Facebook Page to choose.',
'events-virtual'
),
'id' => 'tribe-events-virtual-facebook-page',
'class' => 'tribe-events-virtual-meetings-facebook__page-dropdown',
'name' => 'tribe-events-virtual[facebook_local_id]',
'selected' => $post->facebook_local_id,
'attrs' => [
'placeholder' => _x(
'Select a Facebook Page',
'The placeholder for the dropdown to select a Facebook Page.',
'events-virtual'
),
'data-prevent-clear' => '1',
'data-options' => json_encode( $pages ),
],
],
],
$echo
);
}
Changelog
| Version | Description |
|---|---|
| 1.7.0 | Introduced. |