WPSEO_Customizer::add_setting_and_control()
Adds the customizer setting and control.
Метод класса: WPSEO_Customizer{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->add_setting_and_control( $index, $control_args, $id, $custom_settings );
- $index(строка) (обязательный)
- Array key index to use for the customizer setting.
- $control_args(массив) (обязательный)
- Customizer control object arguments. Only those different from the default need to be passed.
- $id(строка|null)
- Customizer control object ID. Will default to 'wpseo-' . $index.
По умолчанию: null - $custom_settings(массив)
- Customizer setting arguments. Only those different from the default need to be passed.
По умолчанию: []
Код WPSEO_Customizer::add_setting_and_control() WPSEO Customizer::add setting and control Yoast 22.4
private function add_setting_and_control( $index, $control_args, $id = null, $custom_settings = [] ) { $setting = sprintf( $this->setting_template, $index ); $control_args = array_merge( $this->default_control_args, $control_args ); $control_args['settings'] = $setting; $settings_args = $this->default_setting_args; if ( ! empty( $custom_settings ) ) { $settings_args = array_merge( $settings_args, $custom_settings ); } if ( ! isset( $id ) ) { $id = 'wpseo-' . $index; } $this->wp_customize->add_setting( $setting, $settings_args ); $control = new WP_Customize_Control( $this->wp_customize, $id, $control_args ); $this->wp_customize->add_control( $control ); }