WC_Settings_Page::get_section_settings_data()protectedWC 1.0

Get settings data for a specific section.

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

Хуков нет.

Возвращает

Массив. Settings data for the section.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_section_settings_data( $section_id, $sections );
$section_id(строка) (обязательный)
The ID of the section.
$sections(массив) (обязательный)
All sections available.

Код WC_Settings_Page::get_section_settings_data() WC 9.7.1

protected function get_section_settings_data( $section_id, $sections ) {
	$section_settings_data = array();

	$custom_view = $this->get_custom_view( $section_id );
	// We only want to loop through the settings object if the parent class's output method is being rendered during the get_custom_view call.
	if ( $this->output_called ) {
		$section_settings = count( $sections ) > 1
			? $this->get_settings_for_section( $section_id )
			: $this->get_settings();

		// Loop through each setting in the section and add the value to the settings data.
		foreach ( $section_settings as $section_setting ) {
			$section_settings_data[] = $this->populate_setting_value( $section_setting );
		}
	}

	// If the custom view has output, add it to the settings data.
	if ( ! empty( $custom_view ) ) {
		$section_settings_data[] = array(
			'type'    => 'custom',
			'content' => $custom_view,
		);
	}

	// Reset the output_called property.
	$this->output_called = false;

	return $section_settings_data;
}