Tribe__Customizer::get_option( array $search = null, mixed $default = null )
Get an option from the database, using index search you can retrieve the full panel, a section or even a setting.
Contents
Parameters
- $search
-
(array) (Optional) Index search, array( 'section_name', 'setting_name' ).
Default value: null
- $default
-
(mixed) (Optional) The default, if the requested variable doesn't exits.
Default value: null
Return
(mixed) The requested option or the default.
Source
File: src/Tribe/Customizer.php
public function get_option( $search = null, $default = null ) {
$sections = get_option( $this->ID, $default );
foreach ( $this->get_loaded_sections() as $section ) {
/**
* Allow filtering the defaults for each settings to be filtered before the Ghost options to be set
*
* @deprecated
* @since 4.0
*
* @param array $defaults
*/
$defaults[ $section->ID ] = apply_filters( "tribe_events_pro_customizer_section_{$section->ID}_defaults", array() );
/**
* Allow filtering the defaults for each settings to be filtered before the Ghost options to be set
*
* @since 4.4
*
* @param array $defaults
*/
$settings = isset( $sections[ $section->ID ] ) ? $sections[ $section->ID ] : array();
$defaults[ $section->ID ] = apply_filters( "tribe_customizer_section_{$section->ID}_defaults", $settings );
$sections[ $section->ID ] = wp_parse_args( $settings, $defaults[ $section->ID ] );
}
/**
* Allows Ghost Options to be inserted
*
* @deprecated
* @since 4.0
*
* @param array $sections
* @param array $search
*/
$sections = apply_filters( 'tribe_events_pro_customizer_pre_get_option', $sections, $search );
/**
* Allows Ghost Options to be inserted
*
* @since 4.4
*
* @param array $sections
* @param array $search
*/
$sections = apply_filters( 'tribe_customizer_pre_get_option', $sections, $search );
// Search on the Array
if ( ! is_null( $search ) ) {
$option = self::search_var( $sections, $search, $default );
} else {
$option = $sections;
}
/**
* Apply Filters After finding the variable
*
* @deprecated
* @since 4.0
*
* @param mixed $option
* @param array $search
* @param array $sections
*/
$option = apply_filters( 'tribe_events_pro_customizer_get_option', $option, $search, $sections );
/**
* Apply Filters After finding the variable
*
* @since 4.4
*
* @param mixed $option
* @param array $search
* @param array $sections
*/
$option = apply_filters( 'tribe_customizer_get_option', $option, $search, $sections );
return $option;
}
Changelog
| Version | Description |
|---|---|
| 4.4 | Introduced. |