Automattic\WooCommerce\Admin\API\Reports\Categories

Controller::get_collection_params()publicWC 1.0

Get the query params for collections.

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

Хуков нет.

Возвращает

Массив.

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

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

Код Controller::get_collection_params() WC 8.6.1

public function get_collection_params() {
	$params                        = array();
	$params['context']             = $this->get_context_param( array( '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['after']               = array(
		'description'       => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
		'type'              => 'string',
		'format'            => 'date-time',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['before']              = array(
		'description'       => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
		'type'              => 'string',
		'format'            => 'date-time',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$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'           => 'category_id',
		'enum'              => array(
			'category_id',
			'items_sold',
			'net_revenue',
			'orders_count',
			'products_count',
			'category',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['interval']            = array(
		'description'       => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'week',
		'enum'              => array(
			'hour',
			'day',
			'week',
			'month',
			'quarter',
			'year',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['status_is']           = array(
		'description'       => __( 'Limit result set to items that have the specified order status.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_slug_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'enum' => self::get_order_statuses(),
			'type' => 'string',
		),
	);
	$params['status_is_not']       = array(
		'description'       => __( 'Limit result set to items that don\'t have the specified order status.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_slug_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'enum' => self::get_order_statuses(),
			'type' => 'string',
		),
	);
	$params['categories']          = array(
		'description'       => __( 'Limit result set to all items that have the specified term assigned in the categories taxonomy.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_id_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'type' => 'integer',
		),
	);
	$params['extended_info']       = array(
		'description'       => __( 'Add additional piece of info about each category to the report.', 'woocommerce' ),
		'type'              => 'boolean',
		'default'           => false,
		'sanitize_callback' => 'wc_string_to_bool',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['force_cache_refresh'] = array(
		'description'       => __( 'Force retrieval of fresh data instead of from the cache.', 'woocommerce' ),
		'type'              => 'boolean',
		'sanitize_callback' => 'wp_validate_boolean',
		'validate_callback' => 'rest_validate_request_arg',
	);

	return $params;
}