Automattic\WooCommerce\Internal\Admin\Settings

SettingsUISchema::get_field_valueprivate staticWC 1.0

Get a field value.

Method of the class: SettingsUISchema{}

No Hooks.

Returns

Mixed.

Usage

$result = SettingsUISchema::get_field_value( $setting, $type );
$setting(array) (required)
Legacy field definition.
$type(string) (required)
Canonical field type.

SettingsUISchema::get_field_value() code WC 10.9.4

private static function get_field_value( array $setting, string $type ) {
	if ( array_key_exists( 'value', $setting ) ) {
		return self::normalize_value( $setting['value'], $type );
	}

	$default = $setting['default'] ?? '';
	$value   = \WC_Admin_Settings::get_option( (string) $setting['id'], $default );

	return self::normalize_value( $value, $type );
}