WC_Register_WP_Admin_Settings::register_page_settings() public WC 3.0.0
Registers settings to a specific group.
{} Это метод класса: WC_Register_WP_Admin_Settings{}
Хуков нет.
Возвращает
Массив.
Использование
$WC_Register_WP_Admin_Settings = new WC_Register_WP_Admin_Settings(); $WC_Register_WP_Admin_Settings->register_page_settings( $settings );
- $settings(массив) (обязательный)
- Existing registered settings.
Список изменений
С версии 3.0.0 | Введена. |
Код WC_Register_WP_Admin_Settings::register_page_settings() WC Register WP Admin Settings::register page settings WC 5.0.0
public function register_page_settings( $settings ) {
/**
* WP admin settings can be broken down into separate sections from
* a UI standpoint. This will grab all the sections associated with
* a particular setting group (like 'products') and register them
* to the REST API.
*/
$sections = $this->object->get_sections();
if ( empty( $sections ) ) {
// Default section is just an empty string, per admin page classes.
$sections = array( '' );
}
foreach ( $sections as $section => $section_label ) {
$settings_from_section = $this->object->get_settings( $section );
foreach ( $settings_from_section as $setting ) {
if ( ! isset( $setting['id'] ) ) {
continue;
}
$setting['option_key'] = $setting['id'];
$new_setting = $this->register_setting( $setting );
if ( $new_setting ) {
$settings[] = $new_setting;
}
}
}
return $settings;
}