← All changes
|
lib/compat/wordpress-7.1/class-gutenberg-rest-view-config-controller-7-1.php
+9
-6
23.5.1
→
trunk
View file →
| @@ -140,8 +140,9 @@ | ||
| 140 | 140 | |
| 141 | 141 | $response = array( |
| 142 | 142 | 'kind' => $kind, |
| 143 | 143 | 'name' => $name, |
| 144 | + 'version' => Gutenberg_View_Config_Data::LATEST_VERSION, | |
| 144 | 145 | 'default_view' => $this->cast_empty_objects( $config['default_view'], $schema['properties']['default_view'] ), |
| 145 | 146 | 'default_layouts' => $this->cast_empty_objects( $config['default_layouts'], $schema['properties']['default_layouts'] ), |
| 146 | 147 | 'view_list' => $this->cast_empty_objects( $config['view_list'], $schema['properties']['view_list'] ), |
| 147 | 148 | 'form' => $this->cast_empty_objects( $config['form'], $schema['properties']['form'] ), |
| @@ -249,8 +250,13 @@ | ||
| 249 | 250 | 'description' => __( 'Entity name.', 'gutenberg' ), |
| 250 | 251 | 'type' => 'string', |
| 251 | 252 | 'readonly' => true, |
| 252 | 253 | ), |
| 254 | + 'version' => array( | |
| 255 | + 'description' => __( 'The schema version of the configuration.', 'gutenberg' ), | |
| 256 | + 'type' => 'integer', | |
| 257 | + 'readonly' => true, | |
| 258 | + ), | |
| 253 | 259 | 'default_view' => array( |
| 254 | 260 | 'description' => __( 'Default view configuration.', 'gutenberg' ), |
| 255 | 261 | 'type' => 'object', |
| 256 | 262 | 'readonly' => true, |
| @@ -367,15 +373,15 @@ | ||
| 367 | 373 | |
| 368 | 374 | /** |
| 369 | 375 | * Returns the schema properties shared by all view types (ViewBase), excluding 'type'. |
| 370 | 376 | * |
| 377 | + * Note that `search` and `page` are not part of the schema: they are managed | |
| 378 | + * via the URL, which is their only source of truth. | |
| 379 | + * | |
| 371 | 380 | * @return array Schema properties for the base view configuration. |
| 372 | 381 | */ |
| 373 | 382 | protected function get_view_base_schema() { |
| 374 | 383 | return array( |
| 375 | - 'search' => array( | |
| 376 | - 'type' => 'string', | |
| 377 | - ), | |
| 378 | 384 | 'filters' => array( |
| 379 | 385 | 'type' => 'array', |
| 380 | 386 | 'items' => array( |
| 381 | 387 | 'type' => 'object', |
| @@ -417,11 +423,8 @@ | ||
| 417 | 423 | 'type' => 'string', |
| 418 | 424 | 'enum' => array( 'asc', 'desc' ), |
| 419 | 425 | ), |
| 420 | 426 | ), |
| 421 | - ), | |
| 422 | - 'page' => array( | |
| 423 | - 'type' => 'integer', | |
| 424 | 427 | ), |
| 425 | 428 | 'perPage' => array( |
| 426 | 429 | 'type' => 'integer', |
| 427 | 430 | ), |