WC_Settings_Page::populate_setting_value()protectedWC 1.0

Populate the value for a given section setting.

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

Хуков нет.

Возвращает

Массив. The setting array with populated value.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->populate_setting_value( $section_setting );
$section_setting(массив) (обязательный)
The setting array to populate.

Код WC_Settings_Page::populate_setting_value() WC 9.7.1

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;
}