WC_REST_Data_Continents_Controller::get_item_schema()publicWC 3.5.0

Get the location schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

$WC_REST_Data_Continents_Controller = new WC_REST_Data_Continents_Controller();
$WC_REST_Data_Continents_Controller->get_item_schema();

Список изменений

С версии 3.5.0 Введена.

Код WC_REST_Data_Continents_Controller::get_item_schema() WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'data_continents',
		'type'       => 'object',
		'properties' => array(
			'code'      => array(
				'type'        => 'string',
				'description' => __( '2 character continent code.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'name'      => array(
				'type'        => 'string',
				'description' => __( 'Full name of continent.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'countries' => array(
				'type'        => 'array',
				'description' => __( 'List of countries on this continent.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
				'items'       => array(
					'type'       => 'object',
					'context'    => array( 'view' ),
					'readonly'   => true,
					'properties' => array(
						'code'           => array(
							'type'        => 'string',
							'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
						'currency_code'  => array(
							'type'        => 'string',
							'description' => __( 'Default ISO4127 alpha-3 currency code for the country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
						'currency_pos'   => array(
							'type'        => 'string',
							'description' => __( 'Currency symbol position for this country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
						'decimal_sep'    => array(
							'type'        => 'string',
							'description' => __( 'Decimal separator for displayed prices for this country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
						'dimension_unit' => array(
							'type'        => 'string',
							'description' => __( 'The unit lengths are defined in for this country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
						'name'           => array(
							'type'        => 'string',
							'description' => __( 'Full name of country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
						'num_decimals'   => array(
							'type'        => 'integer',
							'description' => __( 'Number of decimal points shown in displayed prices for this country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
						'states'         => array(
							'type'        => 'array',
							'description' => __( 'List of states in this country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
							'items'       => array(
								'type'       => 'object',
								'context'    => array( 'view' ),
								'readonly'   => true,
								'properties' => array(
									'code' => array(
										'type'        => 'string',
										'description' => __( 'State code.', 'woocommerce' ),
										'context'     => array( 'view' ),
										'readonly'    => true,
									),
									'name' => array(
										'type'        => 'string',
										'description' => __( 'Full name of state.', 'woocommerce' ),
										'context'     => array( 'view' ),
										'readonly'    => true,
									),
								),
							),
						),
						'thousand_sep'   => array(
							'type'        => 'string',
							'description' => __( 'Thousands separator for displayed prices in this country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
						'weight_unit'    => array(
							'type'        => 'string',
							'description' => __( 'The unit weights are defined in for this country.', 'woocommerce' ),
							'context'     => array( 'view' ),
							'readonly'    => true,
						),
					),
				),
			),
		),
	);

	return $this->add_additional_fields_schema( $schema );
}