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

EmailSettingsSchema::map_setting_type_to_api_type │ private │ WC 1.0

Map WooCommerce setting type to REST API type.

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

Хуков нет.

Возвращает

string. REST API type.

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

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

Код EmailSettingsSchema::map_setting_type_to_api_type() WC 11.2.2

private function map_setting_type_to_api_type( string $setting_type ): string {
	$type_map = array(
		'text'     => 'text',
		'email'    => 'email',
		'checkbox' => 'checkbox',
		'number'   => 'number',
		'color'    => 'color',
		'select'   => 'select',
	);

	return $type_map[ $setting_type ] ?? 'text';
}