From 227556715179b874c383f4890d8ca54e8f405f67 Mon Sep 17 00:00:00 2001 From: ramon Date: Wed, 3 Jan 2024 12:21:26 +1100 Subject: [PATCH] Excluding search, include and exclude from the collection query params Excluding order and order by from the collection query params Comment --- ...est-global-styles-revisions-controller.php | 18 +++++++ ...est-global-styles-revisions-controller.php | 2 +- tests/qunit/fixtures/wp-api-generated.js | 48 ------------------- 3 files changed, 19 insertions(+), 49 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php index 68e05339d9c87..c71ada44364ef 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php @@ -388,4 +388,22 @@ public function get_item_schema() { return $this->add_additional_fields_schema( $this->schema ); } + + /** + * Retrieves the query params for collections. + * Removes params that are not supported by global styles revisions. + * + * @since 6.5.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() { + $query_params = parent::get_collection_params(); + unset( $query_params['exclude'] ); + unset( $query_params['include'] ); + unset( $query_params['search'] ); + unset( $query_params['order'] ); + unset( $query_params['orderby'] ); + return $query_params; + } } diff --git a/tests/phpunit/tests/rest-api/rest-global-styles-revisions-controller.php b/tests/phpunit/tests/rest-api/rest-global-styles-revisions-controller.php index 9afddce615d14..5e6385c730ab3 100644 --- a/tests/phpunit/tests/rest-api/rest-global-styles-revisions-controller.php +++ b/tests/phpunit/tests/rest-api/rest-global-styles-revisions-controller.php @@ -830,7 +830,7 @@ public function test_get_items_out_of_bounds_page_should_not_error_if_offset() { * @doesNotPerformAssertions */ public function test_context_param() { - // Controller does not implement test_context_param(). + // Controller does not implement get_context_param(). } /** diff --git a/tests/qunit/fixtures/wp-api-generated.js b/tests/qunit/fixtures/wp-api-generated.js index de6c36a1643e0..6c961548eb8e2 100644 --- a/tests/qunit/fixtures/wp-api-generated.js +++ b/tests/qunit/fixtures/wp-api-generated.js @@ -10035,58 +10035,10 @@ mockedApiResponse.Schema = { "maximum": 100, "required": false }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, "offset": { "description": "Offset the result set by a specific number of items.", "type": "integer", "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by object attribute.", - "type": "string", - "default": "date", - "enum": [ - "date", - "id", - "include", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false } } }