WC_REST_Shipping_Zones_V2_Controller::get_item_schema()publicWC 1.0

Get the Shipping Zones schema, conforming to JSON Schema

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Shipping_Zones_V2_Controller::get_item_schema() WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'shipping_zone',
		'type'       => 'object',
		'properties' => array(
			'id'    => array(
				'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'name'  => array(
				'description' => __( 'Shipping zone name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'arg_options' => array(
					'sanitize_callback' => 'sanitize_text_field',
				),
			),
			'order' => array(
				'description' => __( 'Shipping zone order.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
			),
		),
	);

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