WC_Settings_Page::get_section_settings_data
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 Settings Page::get section settings data WC 10.3.6
protected function get_section_settings_data( $section_id, $sections ) {
$section_settings_data = array();
$custom_view = $this->get_custom_view( 'woocommerce_settings_' . $this->id, $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 ) {
// Add custom views for sectionend.
if ( 'sectionend' === $section_setting['type'] && ! empty( $section_setting['id'] ) ) {
$section_settings_data[] = $this->get_custom_view( 'woocommerce_settings_' . $section_setting['id'] . '_end' );
$section_settings_data[] = $this->get_custom_view( 'woocommerce_settings_' . $section_setting['id'] . '_after' );
}
$section_settings_data[] = $this->populate_setting_value( $section_setting );
// Add custom views for title.
if ( 'title' === $section_setting['type'] && ! empty( $section_setting['id'] ) ) {
$section_settings_data[] = $this->get_custom_view( 'woocommerce_settings_' . $section_setting['id'] );
}
}
}
// If the custom view has output, add it to the settings data.
if ( ! empty( $custom_view ) ) {
$section_settings_data[] = $custom_view;
}
// Reset the output_called property.
$this->output_called = false;
return $section_settings_data;
}