WC_REST_Product_Reviews_V1_Controller::get_item_schema()publicWC 1.0

Get the Product Review's schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Product_Reviews_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'      => 'product_review',
		'type'       => 'object',
		'properties' => array(
			'id' => array(
				'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'review' => array(
				'description' => __( 'The content of the review.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'date_created' => array(
				'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce' ),
				'type'        => 'date-time',
				'context'     => array( 'view', 'edit' ),
			),
			'rating' => array(
				'description' => __( 'Review rating (0 to 5).', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
			),
			'name' => array(
				'description' => __( 'Reviewer name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'email' => array(
				'description' => __( 'Reviewer email.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'verified' => array(
				'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce' ),
				'type'        => 'boolean',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
		),
	);

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