WC_Settings_Page::add_settings_page_data()publicWC 1.0

Get page settings data to populate the settings editor.

Метод класса: WC_Settings_Page{}

Хуков нет.

Возвращает

Массив.

Использование

$WC_Settings_Page = new WC_Settings_Page();
$WC_Settings_Page->add_settings_page_data( $pages );
$pages(массив) (обязательный)
The settings array where we'll add data.

Код WC_Settings_Page::add_settings_page_data() WC 9.7.1

public function add_settings_page_data( $pages ) {
	$sections      = $this->get_sections();
	$sections_data = array();

	// Loop through each section and get the settings for that section.
	foreach ( $sections as $section_id => $section_label ) {
		$section_settings_data = $this->get_section_settings_data( $section_id, $sections );

		// Replace empty string section ids with 'default'.
		$normalized_section_id                   = '' === $section_id ? 'default' : $section_id;
		$sections_data[ $normalized_section_id ] = array(
			'label'    => html_entity_decode( $section_label ),
			'settings' => $section_settings_data,
		);
	}

	$pages[ $this->id ] = array(
		'label'     => html_entity_decode( $this->label ),
		'slug'      => $this->id,
		'icon'      => $this->icon,
		'sections'  => $sections_data,
		'is_modern' => $this->is_modern,
	);

	return $pages;
}