WC_REST_Terms_Controller::get_collection_params()publicWC 1.0

Get the query params for collections

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Terms_Controller::get_collection_params() WC 8.7.0

public function get_collection_params() {
	$params = parent::get_collection_params();

	$params['context']['default'] = 'view';

	$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['offset']     = array(
		'description'       => __( 'Offset the result set by a specific number of items. Applies to hierarchical taxonomies only.', 'woocommerce' ),
		'type'              => 'integer',
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['order']      = array(
		'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
		'type'              => 'string',
		'sanitize_callback' => 'sanitize_key',
		'default'           => 'asc',
		'enum'              => array(
			'asc',
			'desc',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['orderby']    = array(
		'description'       => __( 'Sort collection by resource attribute.', 'woocommerce' ),
		'type'              => 'string',
		'sanitize_callback' => 'sanitize_key',
		'default'           => 'name',
		'enum'              => array(
			'id',
			'include',
			'name',
			'slug',
			'term_group',
			'description',
			'count',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['hide_empty'] = array(
		'description'       => __( 'Whether to hide resources not assigned to any products.', 'woocommerce' ),
		'type'              => 'boolean',
		'default'           => false,
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['parent']     = array(
		'description'       => __( 'Limit result set to resources assigned to a specific parent. Applies to hierarchical taxonomies only.', 'woocommerce' ),
		'type'              => 'integer',
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['product']    = array(
		'description'       => __( 'Limit result set to resources assigned to a specific product.', 'woocommerce' ),
		'type'              => 'integer',
		'default'           => null,
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['slug']       = array(
		'description'       => __( 'Limit result set to resources with a specific slug.', 'woocommerce' ),
		'type'              => 'string',
		'validate_callback' => 'rest_validate_request_arg',
	);

	return $params;
}