[REST API] Fixed some schema contexts

This commit is contained in:
Claudio Sanches 2016-05-10 13:41:15 -03:00
parent eaa0e6884c
commit d7e874324a
4 changed files with 7 additions and 8 deletions

View File

@ -44,8 +44,7 @@ class WC_REST_Product_Attribute_Terms_Controller extends WC_REST_Terms_Controlle
* @return WP_REST_Response $response
*/
public function prepare_item_for_response( $item, $request ) {
// Get term order
// Get term order.
$menu_order = get_woocommerce_term_meta( $item->term_id, 'order_' . $this->taxonomy );
$data = array(
@ -127,12 +126,12 @@ class WC_REST_Product_Attribute_Terms_Controller extends WC_REST_Terms_Controlle
'menu_order' => array(
'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit', 'woocommerce' ),
'context' => array( 'view', 'edit' ),
),
'count' => array(
'description' => __( 'Number of published products for the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit', 'woocommerce' ),
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
),

View File

@ -60,7 +60,7 @@ class WC_REST_Product_Categories_Controller extends WC_REST_Terms_Controller {
$image = wp_get_attachment_url( $image_id );
}
// Get category order
// Get category order.
$menu_order = get_woocommerce_term_meta( $item->term_id, 'order' );
$data = array(
@ -193,7 +193,7 @@ class WC_REST_Product_Categories_Controller extends WC_REST_Terms_Controller {
'count' => array(
'description' => __( 'Number of published products for the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit', 'woocommerce' ),
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
),

View File

@ -129,7 +129,7 @@ class WC_REST_Product_Shipping_Classes_Controller extends WC_REST_Terms_Controll
'count' => array(
'description' => __( 'Number of published products for the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit', 'woocommerce' ),
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
),

View File

@ -123,7 +123,7 @@ class WC_REST_Product_Tags_Controller extends WC_REST_Terms_Controller {
'count' => array(
'description' => __( 'Number of published products for the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit', 'woocommerce' ),
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
),