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

AbstractPaymentGatewaySettingsSchema::normalize_field_typeprivateWC 1.0

Normalize WooCommerce field types to standard REST API types.

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

Хуков нет.

Возвращает

Строку.

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

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

Код AbstractPaymentGatewaySettingsSchema::normalize_field_type() WC 10.5.2

private function normalize_field_type( string $wc_type ): string {
	$type_map = array(
		'email'       => 'text',
		'password'    => 'text',
		'textarea'    => 'text',
		'safe_text'   => 'text',
		'color'       => 'text',
		'image_width' => 'text',
		'radio'       => 'select',
	);

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