Automattic\WooCommerce\Blocks\StoreApi\Schemas
ProductReviewSchema::get_properties() public WC 1.0
Product review schema properties.
{} It's a method of the class: ProductReviewSchema{}
No Hooks.
Return
Array.
Usage
$ProductReviewSchema = new ProductReviewSchema(); $ProductReviewSchema->get_properties();
Code of ProductReviewSchema::get_properties() ProductReviewSchema::get properties WC 5.0.0
<?php
public function get_properties() {
$properties = [
'id' => [
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'date_created' => [
'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce' ),
'type' => 'string',
'format' => 'date-time',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'formatted_date_created' => [
'description' => __( "The date the review was created, in the site's timezone in human-readable format.", 'woocommerce' ),
'type' => 'string',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'date_created_gmt' => [
'description' => __( 'The date the review was created, as GMT.', 'woocommerce' ),
'type' => 'string',
'format' => 'date-time',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'product_id' => [
'description' => __( 'Unique identifier for the product that the review belongs to.', 'woocommerce' ),
'type' => 'integer',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'product_name' => [
'description' => __( 'Name of the product that the review belongs to.', 'woocommerce' ),
'type' => 'string',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'product_permalink' => [
'description' => __( 'Permalink of the product that the review belongs to.', 'woocommerce' ),
'type' => 'string',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'product_image' => [
'description' => __( 'Image of the product that the review belongs to.', 'woocommerce' ),
'type' => 'object',
'context' => [ 'view', 'edit' ],
'readonly' => true,
'properties' => $this->image_attachment_schema->get_properties(),
],
'reviewer' => [
'description' => __( 'Reviewer name.', 'woocommerce' ),
'type' => 'string',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'review' => [
'description' => __( 'The content of the review.', 'woocommerce' ),
'type' => 'string',
'context' => [ 'view', 'edit' ],
'arg_options' => [
'sanitize_callback' => 'wp_filter_post_kses',
],
'readonly' => true,
],
'rating' => [
'description' => __( 'Review rating (0 to 5).', 'woocommerce' ),
'type' => 'integer',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
'verified' => [
'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce' ),
'type' => 'boolean',
'context' => [ 'view', 'edit' ],
'readonly' => true,
],
];
if ( get_option( 'show_avatars' ) ) {
$avatar_properties = array();
$avatar_sizes = rest_get_avatar_sizes();
foreach ( $avatar_sizes as $size ) {
$avatar_properties[ $size ] = array(
/* translators: %d: avatar image size in pixels */
'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'woocommerce' ), $size ),
'type' => 'string',
'format' => 'uri',
'context' => array( 'embed', 'view', 'edit' ),
);
}
$properties['reviewer_avatar_urls'] = array(
'description' => __( 'Avatar URLs for the object reviewer.', 'woocommerce' ),
'type' => 'object',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => $avatar_properties,
);
}
return $properties;
}