WC_REST_Product_Custom_Fields_Controller::get_collection_params()publicWC 1.0

Add new options for 'order' to the collection params.

Method of the class: WC_REST_Product_Custom_Fields_Controller{}

No Hooks.

Return

Array.

Usage

$WC_REST_Product_Custom_Fields_Controller = new WC_REST_Product_Custom_Fields_Controller();
$WC_REST_Product_Custom_Fields_Controller->get_collection_params();

WC_REST_Product_Custom_Fields_Controller::get_collection_params() code WC 9.5.1

public function get_collection_params() {
	$params          = parent::get_collection_params();
	$params['order'] = array(
		'description'       => __( 'Order sort items ascending or descending.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'asc',
		'enum'              => array( 'asc', 'desc' ),
		'validate_callback' => 'rest_validate_request_arg',
	);
	return $params;
}