On this page
WP_REST_Block_Directory_Controller::get_collection_params(): array
Retrieves the search params for the blocks collection.
Return
array Collection parameters.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php. View all references
public function get_collection_params() {
$query_params = parent::get_collection_params();
$query_params['context']['default'] = 'view';
$query_params['term'] = array(
'description' => __( 'Limit result set to blocks matching the search term.' ),
'type' => 'string',
'required' => true,
'minLength' => 1,
);
unset( $query_params['search'] );
/**
* Filters REST API collection parameters for the block directory controller.
*
* @since 5.5.0
*
* @param array $query_params JSON Schema-formatted collection parameters.
*/
return apply_filters( 'rest_block_directory_collection_params', $query_params );
}
Hooks
- apply_filters( 'rest_block_directory_collection_params',
array $query_params ) -
Filters REST API collection parameters for the block directory controller.
Related
Uses
| Uses | Description |
|---|---|
| WP_REST_Controller::get_collection_params() wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Retrieves the query params for the collections. |
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Block_Directory_Controller::register_routes() wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Registers the necessary REST API routes. |
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_block_directory_controller/get_collection_params