Automattic\WooCommerce\Internal\Admin\Settings
SettingsUISchema::normalize_value
Normalize a value for the canonical schema.
Method of the class: SettingsUISchema{}
No Hooks.
Returns
Mixed.
Usage
$result = SettingsUISchema::normalize_value( $value, $type );
- $value(mixed) (required)
- Field value.
- $type(string) (required)
- Canonical type.
SettingsUISchema::normalize_value() SettingsUISchema::normalize value code WC 10.9.1
private static function normalize_value( $value, string $type ) {
switch ( $type ) {
case 'array':
return is_array( $value ) ? array_values( $value ) : array();
case 'checkbox':
return function_exists( 'wc_string_to_bool' ) ? wc_string_to_bool( $value ) : (bool) $value;
default:
return $value;
}
}