WC_Settings_Page::get_section_settings_data()
Get settings data for a specific section.
Method of the class: WC_Settings_Page{}
No Hooks.
Return
Array
. Settings data for the section.
Usage
// protected - for code of main (parent) or child class $result = $this->get_section_settings_data( $section_id, $sections );
- $section_id(string) (required)
- The ID of the section.
- $sections(array) (required)
- All sections available.
WC_Settings_Page::get_section_settings_data() WC Settings Page::get section settings data code 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; }