WP_REST_Pattern_Directory_Controller::get_collection_params()publicWP 5.8.0

Retrieves the search parameters for the block pattern's collection.

{} Это метод класса: WP_REST_Pattern_Directory_Controller{}

Хуки из метода

Возвращает

Массив. Collection parameters.

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

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

Список изменений

С версии 5.8.0 Введена.

Код WP_REST_Pattern_Directory_Controller::get_collection_params() WP 6.0.2

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

	// Pagination is not supported.
	unset( $query_params['page'] );
	unset( $query_params['per_page'] );

	$query_params['search']['minLength'] = 1;
	$query_params['context']['default']  = 'view';

	$query_params['category'] = array(
		'description' => __( 'Limit results to those matching a category ID.' ),
		'type'        => 'integer',
		'minimum'     => 1,
	);

	$query_params['keyword'] = array(
		'description' => __( 'Limit results to those matching a keyword ID.' ),
		'type'        => 'integer',
		'minimum'     => 1,
	);

	$query_params['slug'] = array(
		'description' => __( 'Limit results to those matching a pattern (slug).' ),
		'type'        => 'array',
	);

	/**
	 * Filter collection parameters for the block pattern directory controller.
	 *
	 * @since 5.8.0
	 *
	 * @param array $query_params JSON Schema-formatted collection parameters.
	 */
	return apply_filters( 'rest_pattern_directory_collection_params', $query_params );
}