Tribe__Events__Aggregator__Tabs::register( string|object $tab )
Register a new tab on the Aggregator page
Contents
Parameters
- $tab
-
(string|object) (Required) A list of
Return
(object|boolean) The instance of the tab or false if we couldn't register
Source
File: src/Tribe/Aggregator/Tabs.php
public function register( $tab ) {
// If Obj is a string, check if it's existing class, then get an instance of it
if ( is_string( $tab ) && class_exists( $tab ) && method_exists( $tab, 'instance' ) ) {
$tab = call_user_func_array( array( $tab, 'instance' ), array() );
}
// Makes sure that the tab you are registering is extended from the Abstract
if ( ! is_object( $tab ) || ! in_array( 'Tribe__Events__Aggregator__Tabs__Abstract', class_parents( $tab ) ) ) {
return false;
}
// Set the Tab Item on the array of Tabs
$this->items[ $tab->get_slug() ] = $tab;
// Return the tab
return $tab;
}