Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\General\Schema

GeneralSettingsSchema::normalize_field_type │ private │ WC 1.0

Normalize WooCommerce field types to REST API field types.

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

Хуков нет.

Возвращает

string. Normalized field type.

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

// private - только в коде основоного (родительского) класса
$result = $this->normalize_field_type( $wc_type ): string;
$wc_type(строка) (обязательный)
WooCommerce field type.

Код GeneralSettingsSchema::normalize_field_type() WC 11.2.2

private function normalize_field_type( string $wc_type ): string {
	$type_map = array(
		'single_select_country'  => 'select',
		'multi_select_countries' => 'multiselect',
	);

	return $type_map[ $wc_type ] ?? $wc_type;
}