WC_REST_Taxes_V1_Controller::get_collection_params()publicWC 1.0

Get the query params for collections.

Method of the class: WC_REST_Taxes_V1_Controller{}

No Hooks.

Return

Array.

Usage

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

WC_REST_Taxes_V1_Controller::get_collection_params() code WC 8.7.0

public function get_collection_params() {
	$params                       = array();
	$params['context']            = $this->get_context_param();
	$params['context']['default'] = 'view';

	$params['page']     = array(
		'description'       => __( 'Current page of the collection.', 'woocommerce' ),
		'type'              => 'integer',
		'default'           => 1,
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
		'minimum'           => 1,
	);
	$params['per_page'] = array(
		'description'       => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
		'type'              => 'integer',
		'default'           => 10,
		'minimum'           => 1,
		'maximum'           => 100,
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['offset']   = array(
		'description'       => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
		'type'              => 'integer',
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['order']    = array(
		'default'           => 'asc',
		'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
		'enum'              => array( 'asc', 'desc' ),
		'sanitize_callback' => 'sanitize_key',
		'type'              => 'string',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['orderby']  = array(
		'default'           => 'order',
		'description'       => __( 'Sort collection by object attribute.', 'woocommerce' ),
		'enum'              => array(
			'id',
			'order',
			'priority',
		),
		'sanitize_callback' => 'sanitize_key',
		'type'              => 'string',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['class']    = array(
		'description'       => __( 'Sort by tax class.', 'woocommerce' ),
		'enum'              => array_merge( array( 'standard' ), WC_Tax::get_tax_class_slugs() ),
		'sanitize_callback' => 'sanitize_title',
		'type'              => 'string',
		'validate_callback' => 'rest_validate_request_arg',
	);

	return $params;
}