GC_Customize_Setting::set_root_value()
最后更新于:2021-11-27 08:45:04
GC_Customize_Setting::set_root_value( mixed$value)Set the root value for a setting, especially for multidimensional ones.
参数
- $value
-
(mixed) (Required) Value to set as root of multidimensional setting.
响应
(bool) Whether the multidimensional root was updated successfully.
源文件
文件: gc-includes/class-gc-customize-setting.php
protected function set_root_value( $value ) {
$id_base = $this->id_data['base'];
if ( 'option' === $this->type ) {
$autoload = true;
if ( isset( self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload'] ) ) {
$autoload = self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload'];
}
return update_option( $id_base, $value, $autoload );
} elseif ( 'theme_mod' === $this->type ) {
set_theme_mod( $id_base, $value );
return true;
} else {
/*
* Any GC_Customize_Setting subclass implementing aggregate multidimensional
* will need to override this method to obtain the data from the appropriate
* location.
*/
return false;
}
}