$obj = new TitanFrameworkAdminPanel( $settings, $this );
$obj = new TitanFrameworkAdminPanel( $settings, $this );
$this->adminPanels[] = $obj;
$this->adminPanels[] = $obj;
return $obj;
return $obj;
}
}
public function createMetaBox( $settings ) {
public function createMetaBox( $settings ) {
$obj = new TitanFrameworkMetaBox( $settings, $this );
$obj = new TitanFrameworkMetaBox( $settings, $this );
$this->metaBoxes[] = $obj;
$this->metaBoxes[] = $obj;
return $obj;
return $obj;
}
}
public function createThemeCustomizerSection( $settings ) {
public function createThemeCustomizerSection( $settings ) {
$obj = new TitanFrameworkThemeCustomizerSection( $settings, $this );
$obj = new TitanFrameworkThemeCustomizerSection( $settings, $this );
$this->themeCustomizerSections[] = $obj;
$this->themeCustomizerSections[] = $obj;
return $obj;
return $obj;
}
}
/**
/**
* A function available ONLY to CHILD themes to stop the creation of options
* A function available ONLY to CHILD themes to stop the creation of options
* created by the PARENT theme.
* created by the PARENT theme.
*
*
* @access public
* @access public
* @param string $optionName The id of the option to remove / stop from being created
* @param string $optionName The id of the option to remove / stop from being created
* @return void
* @return void
* @since 1.2.1
* @since 1.2.1
*/
*/
public function removeOption( $optionName ) {
public function removeOption( $optionName ) {
$this->optionsToRemove[] = $optionName;
$this->optionsToRemove[] = $optionName;
}
}
/**
/**
* Hook to the tf_create_option_continue filter, to check whether or not to continue
* Hook to the tf_create_option_continue filter, to check whether or not to continue
* adding an option (if the option id was used in $titan->removeOption).
* adding an option (if the option id was used in $titan->removeOption).
*
*
* @access public
* @access public
* @param boolean $continueCreating If true, the option will be created
* @param boolean $continueCreating If true, the option will be created
* @param array $optionSettings The settings for the option to be created
* @param array $optionSettings The settings for the option to be created
* @return boolean If true, continue with creating the option. False to stop it.
* @return boolean If true, continue with creating the option. False to stop it.
* @since 1.2.1
* @since 1.2.1
*/
*/
public function removeChildThemeOptions( $continueCreating, $optionSettings ) {
public function removeChildThemeOptions( $continueCreating, $optionSettings ) {
if ( ! count( $this->optionsToRemove ) ) {
if ( ! count( $this->optionsToRemove ) ) {
return $continueCreating;
return $continueCreating;
}
}
if ( empty( $optionSettings['id'] ) ) {
if ( empty( $optionSettings['id'] ) ) {
return $continueCreating;
return $continueCreating;
}
}
if ( in_array( $optionSettings['id'], $this->optionsToRemove ) ) {
if ( in_array( $optionSettings['id'], $this->optionsToRemove ) ) {
return false;
return false;
}
}
return $continueCreating;
return $continueCreating;
}
}
public function getOption( $optionName, $postID = null ) {
public function getOption( $optionName, $postID = null ) {
$value = null;
$value = null;
// Get the option value
// Get the option value
if ( array_key_exists( $optionName, $this->optionsUsed ) ) {
if ( array_key_exists( $optionName, $this->optionsUsed ) ) {
$option = $this->optionsUsed[ $optionName ];
$option = $this->optionsUsed[ $optionName ];
// Admin page options
// Admin page options
if ( $option->type == TitanFrameworkOption::TYPE_ADMIN ) {
if ( $option->type == TitanFrameworkOption::TYPE_ADMIN ) {
// this is blank if called too early. getOption should be called inside a hook or template
// this is blank if called too early. getOption should be called inside a hook or template
if ( ! is_array( $this->allOptions ) ) {
if ( ! is_array( $this->allOptions ) ) {
self::displayFrameworkError( sprintf( __( 'Wrong usage of %s, this should be called inside a hook or from within a theme file.', TF_I18NDOMAIN ), '<code>getOption</code>' ) );
self::displayFrameworkError( sprintf( __( 'Wrong usage of %s, this should be called inside a hook or from within a theme file.', TF_I18NDOMAIN ), '<code>getOption</code>' ) );
// this is blank if called too early. getOption should be called inside a hook or template
// this is blank if called too early. getOption should be called inside a hook or template
self::displayFrameworkError( sprintf( __( 'Wrong usage of %s, this should be called inside a hook or from within a theme file.', TF_I18NDOMAIN ), '<code>setOption</code>' ) );
self::displayFrameworkError( sprintf( __( 'Wrong usage of %s, this should be called inside a hook or from within a theme file.', TF_I18NDOMAIN ), '<code>setOption</code>' ) );
return '';
return '';
}
}
if ( array_key_exists( $optionName, $this->allOptions[$this->optionNamespace] ) ) {
if ( array_key_exists( $optionName, $this->allOptions[$this->optionNamespace] ) ) {