Changeset 54273
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r54269 r54273 197 197 if ( rest_is_field_included( 'hierarchical', $fields ) ) { 198 198 $data['hierarchical'] = $post_type->hierarchical; 199 } 200 201 if ( rest_is_field_included( 'hierarchical', $fields ) ) { 202 $data['has_archive'] = $post_type->has_archive; 199 203 } 200 204 … … 354 358 'readonly' => true, 355 359 ), 360 'has_archive' => array( 361 'description' => __( 'If the value is a string, the value will be used as the archive slug. If the value is false the post type has no archive.' ), 362 'type' => array( 'string', 'boolean' ), 363 'context' => array( 'view', 'edit' ), 364 'readonly' => true, 365 ), 356 366 'taxonomies' => array( 357 367 'description' => __( 'Taxonomies associated with post type.' ), -
trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php
r54269 r54273 168 168 $properties = $data['schema']['properties']; 169 169 170 $this->assertCount( 1 3, $properties, 'Schema should have 13properties' );170 $this->assertCount( 14, $properties, 'Schema should have 14 properties' ); 171 171 $this->assertArrayHasKey( 'capabilities', $properties, '`capabilities` should be included in the schema' ); 172 172 $this->assertArrayHasKey( 'description', $properties, '`description` should be included in the schema' ); … … 177 177 $this->assertArrayHasKey( 'slug', $properties, '`slug` should be included in the schema' ); 178 178 $this->assertArrayHasKey( 'supports', $properties, '`supports` should be included in the schema' ); 179 $this->assertArrayHasKey( 'has_archive', $properties, '`has_archive` should be included in the schema' ); 179 180 $this->assertArrayHasKey( 'taxonomies', $properties, '`taxonomies` should be included in the schema' ); 180 181 $this->assertArrayHasKey( 'rest_base', $properties, '`rest_base` should be included in the schema' ); … … 231 232 $this->assertSame( $post_type_obj->rest_base, $data['rest_base'] ); 232 233 $this->assertSame( $post_type_obj->rest_namespace, $data['rest_namespace'] ); 234 $this->assertSame( $post_type_obj->has_archive, $data['has_archive'] ); 233 235 234 236 $links = test_rest_expand_compact_links( $links ); -
trunk/tests/qunit/fixtures/wp-api-generated.js
r54269 r54273 11664 11664 "description": "", 11665 11665 "hierarchical": false, 11666 "has_archive": false, 11666 11667 "name": "Posts", 11667 11668 "slug": "post", … … 11696 11697 "description": "", 11697 11698 "hierarchical": true, 11699 "has_archive": false, 11698 11700 "name": "Pages", 11699 11701 "slug": "page", … … 11725 11727 "description": "", 11726 11728 "hierarchical": false, 11729 "has_archive": false, 11727 11730 "name": "Media", 11728 11731 "slug": "attachment", … … 11754 11757 "description": "", 11755 11758 "hierarchical": false, 11759 "has_archive": false, 11756 11760 "name": "Navigation Menu Items", 11757 11761 "slug": "nav_menu_item", … … 11785 11789 "description": "", 11786 11790 "hierarchical": false, 11791 "has_archive": false, 11787 11792 "name": "Reusable blocks", 11788 11793 "slug": "wp_block", … … 11814 11819 "description": "Templates to include in your theme.", 11815 11820 "hierarchical": false, 11821 "has_archive": false, 11816 11822 "name": "Templates", 11817 11823 "slug": "wp_template", … … 11843 11849 "description": "Template parts to include in your templates.", 11844 11850 "hierarchical": false, 11851 "has_archive": false, 11845 11852 "name": "Template Parts", 11846 11853 "slug": "wp_template_part", … … 11872 11879 "description": "Navigation menus that can be inserted into your site.", 11873 11880 "hierarchical": false, 11881 "has_archive": false, 11874 11882 "name": "Navigation Menus", 11875 11883 "slug": "wp_navigation", … … 11903 11911 "description": "", 11904 11912 "hierarchical": false, 11913 "has_archive": false, 11905 11914 "name": "Posts", 11906 11915 "slug": "post",
Note: See TracChangeset
for help on using the changeset viewer.