WC_Settings_Page::populate_setting_value
Populate the value for a given section setting.
Method of the class: WC_Settings_Page{}
No Hooks.
Returns
Array. The setting array with populated value.
Usage
// protected - for code of main (parent) or child class $result = $this->populate_setting_value( $section_setting );
- $section_setting(array) (required)
- The setting array to populate.
WC_Settings_Page::populate_setting_value() WC Settings Page::populate setting value code WC 10.5.0
protected function populate_setting_value( $section_setting ) {
if ( isset( $section_setting['id'] ) ) {
$section_setting['value'] = isset( $section_setting['default'] )
// Fallback to the default value if it exists.
? get_option( $section_setting['id'], $section_setting['default'] )
// Otherwise, fallback to false.
: get_option( $section_setting['id'] );
}
$type = $section_setting['type'];
if ( ! in_array( $type, $this->types, true ) ) {
$section_setting = $this->get_custom_type_field( 'woocommerce_admin_field_' . $type, $section_setting );
}
return $section_setting;
}