Page_API::load_page( TribeEventsVirtualMeetingsFacebookarray $page = array() )
Load a specific page into the API.
Contents
Parameters
- $page
-
(<span class="TribeEventsVirtualMeetingsFacebookarrayTribeEventsVirtualMeetingsFacebookarray<string|">TribeEventsVirtualMeetingsFacebookstring>) (Optional) A Facebook Page with the fields to access the API.
Default value: array()
Return
(bool) Whether the page is loaded into the class to use for the API, default is false.
Source
File: src/Tribe/Meetings/Facebook/Page_API.php
public function load_page( array $page = [] ) {
if ( $this->is_valid_page( $page ) ) {
$this->init_page( $page );
return true;
}
// Check for single events first.
$loaded_page = '';
if ( is_singular( TEC::POSTTYPE ) ) {
$post_id = get_the_ID();
// Get the local Facebook Page id and if found, use to get the page.
if ( $local_id = get_post_meta( $post_id, $this->page_local_id_meta_field_name, true ) ) {
$loaded_page = $this->get_page_by_id( $local_id );
}
if ( ! $loaded_page ) {
return false;
}
if ( $this->is_valid_page( $loaded_page ) ) {
$this->init_page( $loaded_page );
return true;
}
}
// If nothing loaded so far and this is the frontend, return false.
if ( ! is_admin() ) {
return false;
}
$local_id = $this->get_local_id_in_admin();
// Get the page id and if found, use to get the page.
if ( $local_id ) {
$loaded_page = $this->get_page_by_id( $local_id );
}
if ( ! $loaded_page ) {
return false;
}
if ( $this->is_valid_page( $loaded_page ) ) {
$this->init_page( $loaded_page );
return true;
}
return false;
}
Changelog
| Version | Description |
|---|---|
| 1.7.0 | Introduced. |