Changeset 62973
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-view-config-data.php
r62970 r62973 356 356 * ```php 357 357 * array( 358 * 'default_view' => array( ' search' => 'new search', 'fields' => array( 'newField' ) ),358 * 'default_view' => array( 'titleField' => 'newTitleField', 'fields' => array( 'newField' ) ), 359 359 * 'default_layouts' => array( 'grid' => array( 'layout' => array( 'badgeFields' => array( 'newField' ) ) ) ), 360 360 * 'view_list' => array( array( 'slug' => 'table', 'title' => 'New title' ) ), … … 362 362 * ``` 363 363 * 364 * - default_view will be updated so the search string is 'new search' and the newField is appended to the list of fields.364 * - default_view will be updated so the titleField is 'newTitleField' and the newField is appended to the list of fields. 365 365 * - default_layouts will be updated so that newField is appended to the badgeFields. 366 366 * - view_list will be updated so that the view with slug 'table' has its title changed to 'New title'. -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php
r62949 r62973 392 392 * Returns the schema properties shared by all view types (ViewBase), excluding 'type'. 393 393 * 394 * Note that `search` and `page` are not part of the schema: they are managed 395 * via the URL, which is their only source of truth. 396 * 394 397 * @since 7.1.0 395 398 * … … 398 401 protected function get_view_base_schema() { 399 402 return array( 400 'search' => array(401 'type' => 'string',402 ),403 403 'filters' => array( 404 404 'type' => 'array', … … 444 444 ), 445 445 ), 446 ),447 'page' => array(448 'type' => 'integer',449 446 ), 450 447 'perPage' => array( -
trunk/tests/phpunit/tests/rest-api/rest-view-config-controller.php
r62825 r62973 386 386 ); 387 387 } 388 389 /** 390 * `search` and `page` are not part of the view schema: they are managed via 391 * the URL, which is their only source of truth. 392 * 393 * @covers ::get_item_schema 394 */ 395 public function test_get_item_schema_excludes_url_managed_view_properties() { 396 $controller = new WP_REST_View_Config_Controller(); 397 $schema = $controller->get_item_schema(); 398 399 $views = array( 400 'default_view' => $schema['properties']['default_view']['properties'], 401 'view_list item view' => $schema['properties']['view_list']['items']['properties']['view']['properties'], 402 'default_layouts.table' => $schema['properties']['default_layouts']['properties']['table']['properties'], 403 'default_layouts.grid' => $schema['properties']['default_layouts']['properties']['grid']['properties'], 404 'default_layouts.list' => $schema['properties']['default_layouts']['properties']['list']['properties'], 405 'default_layouts.activity' => $schema['properties']['default_layouts']['properties']['activity']['properties'], 406 ); 407 408 foreach ( $views as $label => $properties ) { 409 $this->assertArrayNotHasKey( 'search', $properties, "$label should not declare a `search` property." ); 410 $this->assertArrayNotHasKey( 'page', $properties, "$label should not declare a `page` property." ); 411 } 412 } 388 413 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)