WC_REST_Product_Shipping_Classes_V1_Controller::get_item_schema()publicWC 1.0

Get the Shipping Class schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Product_Shipping_Classes_V1_Controller::get_item_schema() WC 9.3.3

public function get_item_schema() {
	$schema = array(
		'$schema'              => 'http://json-schema.org/draft-04/schema#',
		'title'                => $this->taxonomy,
		'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 class name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'arg_options' => array(
					'sanitize_callback' => 'sanitize_text_field',
				),
			),
			'slug' => array(
				'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'arg_options' => array(
					'sanitize_callback' => 'sanitize_title',
				),
			),
			'description' => array(
				'description' => __( 'HTML description of the resource.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'arg_options' => array(
					'sanitize_callback' => 'wp_filter_post_kses',
				),
			),
			'count' => array(
				'description' => __( 'Number of published products for the resource.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
		),
	);

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