WC_REST_Report_Sales_V1_Controller::get_collection_params()publicWC 1.0

Get the query params for collections.

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Report_Sales_V1_Controller::get_collection_params() WC 8.7.0

public function get_collection_params() {
	return array(
		'context' => $this->get_context_param( array( 'default' => 'view' ) ),
		'period' => array(
			'description'       => __( 'Report period.', 'woocommerce' ),
			'type'              => 'string',
			'enum'              => array( 'week', 'month', 'last_month', 'year' ),
			'validate_callback' => 'rest_validate_request_arg',
			'sanitize_callback' => 'sanitize_text_field',
		),
		'date_min' => array(
			/* translators: %s: date format */
			'description'       => sprintf( __( 'Return sales for a specific start date, the date need to be in the %s format.', 'woocommerce' ), 'YYYY-MM-DD' ),
			'type'              => 'string',
			'format'            => 'date',
			'validate_callback' => 'wc_rest_validate_reports_request_arg',
			'sanitize_callback' => 'sanitize_text_field',
		),
		'date_max' => array(
			/* translators: %s: date format */
			'description'       => sprintf( __( 'Return sales for a specific end date, the date need to be in the %s format.', 'woocommerce' ), 'YYYY-MM-DD' ),
			'type'              => 'string',
			'format'            => 'date',
			'validate_callback' => 'wc_rest_validate_reports_request_arg',
			'sanitize_callback' => 'sanitize_text_field',
		),
	);
}