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

AbstractPaymentGatewaySettingsSchema::normalize_field_typeprivateWC 1.0

Normalize WooCommerce field types to standard REST API types.

Method of the class: AbstractPaymentGatewaySettingsSchema{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->normalize_field_type( $wc_type ): string;
$wc_type(string) (required)
WooCommerce field type.

AbstractPaymentGatewaySettingsSchema::normalize_field_type() code WC 10.4.3

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