WC_REST_Webhooks_V1_Controller::get_collection_params()publicWC 1.0

Get the query params for collections of attachments.

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Webhooks_V1_Controller::get_collection_params() WC 8.7.0

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

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

	$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['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.', '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',
		'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'           => 'date',
		'enum'              => array(
			'date',
			'id',
			'title',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['status']  = array(
		'default'           => 'all',
		'description'       => __( 'Limit result set to webhooks assigned a specific status.', 'woocommerce' ),
		'type'              => 'string',
		'enum'              => array( 'all', 'active', 'paused', 'disabled' ),
		'sanitize_callback' => 'sanitize_key',
		'validate_callback' => 'rest_validate_request_arg',
	);

	return $params;
}