Changeset 51959
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r51786 r51959 196 196 if ( in_array( 'hierarchical', $fields, true ) ) { 197 197 $data['hierarchical'] = $post_type->hierarchical; 198 } 199 200 if ( in_array( 'visibility', $fields, true ) ) { 201 $data['visibility'] = array( 202 'show_in_nav_menus' => (bool) $post_type->show_in_nav_menus, 203 'show_ui' => (bool) $post_type->show_ui, 204 ); 198 205 } 199 206 … … 338 345 'readonly' => true, 339 346 ), 347 'visibility' => array( 348 'description' => __( 'The visibility settings for the post type.' ), 349 'type' => 'object', 350 'context' => array( 'edit' ), 351 'readonly' => true, 352 'properties' => array( 353 'show_ui' => array( 354 'description' => __( 'Whether to generate a default UI for managing this post type.' ), 355 'type' => 'boolean', 356 ), 357 'show_in_nav_menus' => array( 358 'description' => __( 'Whether to make the post type is available for selection in navigation menus.' ), 359 'type' => 'boolean', 360 ), 361 ), 362 ), 340 363 ), 341 364 ); -
trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php
r51397 r51959 145 145 $data = $response->get_data(); 146 146 $properties = $data['schema']['properties']; 147 $this->assertCount( 1 0, $properties );147 $this->assertCount( 11, $properties ); 148 148 $this->assertArrayHasKey( 'capabilities', $properties ); 149 149 $this->assertArrayHasKey( 'description', $properties ); … … 156 156 $this->assertArrayHasKey( 'taxonomies', $properties ); 157 157 $this->assertArrayHasKey( 'rest_base', $properties ); 158 $this->assertArrayHasKey( 'visibility', $properties ); 158 159 } 159 160 … … 217 218 } 218 219 $this->assertSame( $viewable, $data['viewable'] ); 220 $visibility = array( 221 'show_in_nav_menus' => (bool) $post_type_obj->show_in_nav_menus, 222 'show_ui' => (bool) $post_type_obj->show_ui, 223 ); 224 $this->assertSame( $visibility, $data['visibility'] ); 219 225 $this->assertSame( get_all_post_type_supports( $post_type_obj->name ), $data['supports'] ); 220 226 } else {
Note: See TracChangeset
for help on using the changeset viewer.