Automattic\WooCommerce\StoreApi\Routes\V1

AbstractTermsRoute::get_collection_params()publicWC 1.0

Get the query params for collections of attributes.

Метод класса: AbstractTermsRoute{}

Хуков нет.

Возвращает

Массив.

Использование

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

Код AbstractTermsRoute::get_collection_params() 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. Defaults to no limit if left blank.', 'woocommerce' ),
		'type'              => 'integer',
		'minimum'           => 0,
		'maximum'           => 100,
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
	);

	$params['search'] = array(
		'description'       => __( 'Limit results to those matching a string.', 'woocommerce' ),
		'type'              => 'string',
		'sanitize_callback' => 'sanitize_text_field',
		'validate_callback' => 'rest_validate_request_arg',
	);

	$params['exclude'] = array(
		'description'       => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
		'type'              => 'array',
		'items'             => array(
			'type' => 'integer',
		),
		'default'           => array(),
		'sanitize_callback' => 'wp_parse_id_list',
	);

	$params['include'] = array(
		'description'       => __( 'Limit result set to specific ids.', 'woocommerce' ),
		'type'              => 'array',
		'items'             => array(
			'type' => 'integer',
		),
		'default'           => array(),
		'sanitize_callback' => 'wp_parse_id_list',
	);

	$params['order'] = array(
		'description'       => __( 'Sort ascending or descending.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'asc',
		'enum'              => array( 'asc', 'desc' ),
		'validate_callback' => 'rest_validate_request_arg',
	);

	$params['orderby'] = array(
		'description'       => __( 'Sort by term property.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'name',
		'enum'              => array(
			'name',
			'slug',
			'count',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);

	$params['hide_empty'] = array(
		'description' => __( 'If true, empty terms will not be returned.', 'woocommerce' ),
		'type'        => 'boolean',
		'default'     => true,
	);

	return $params;
}