Automattic\WooCommerce\Admin\API\Reports

GenericStatsController::get_collection_params()publicWC 1.0

Get the query params definition for collections. Adds fields & intervals to the generic list.

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

Хуков нет.

Возвращает

Массив.

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

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

Код GenericStatsController::get_collection_params() WC 9.4.2

public function get_collection_params() {
	$params             = parent::get_collection_params();
	$params['fields']   = array(
		'description'       => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_slug_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'type' => 'string',
		),
	);
	$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',
	);

	return $params;
}