Automattic\WooCommerce\Admin\API

Notes::get_collection_params()publicWC 1.0

Get the query params for collections.

Method of the class: Notes{}

No Hooks.

Return

Array.

Usage

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

Notes::get_collection_params() code WC 8.6.1

public function get_collection_params() {
	$params             = array();
	$params['context']  = $this->get_context_param( array( 'default' => 'view' ) );
	$params['order']    = array(
		'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'desc',
		'enum'              => array( 'asc', 'desc' ),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['orderby']  = array(
		'description'       => __( 'Sort collection by object attribute.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'date',
		'enum'              => array(
			'note_id',
			'date',
			'type',
			'title',
			'status',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$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['type']     = array(
		'description'       => __( 'Type of note.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_slug_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'enum' => Note::get_allowed_types(),
			'type' => 'string',
		),
	);
	$params['status']   = array(
		'description'       => __( 'Status of note.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_slug_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'enum' => Note::get_allowed_statuses(),
			'type' => 'string',
		),
	);
	$params['source']   = array(
		'description'       => __( 'Source of note.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'type' => 'string',
		),
	);
	return $params;
}