mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-29 04:28:07 +01:00
REST API: Include viewable
attribute on Post Type resource for edit
context.
For the block editor to be able to expose the Preview button correctly, it needs to know the `is_post_type_viewable()` setting, this change adds it to the Post Type response. Props danielbachhuber. Merges [43007] to the 4.9 branch. Fixes #43739. Built from https://develop.svn.wordpress.org/branches/4.9@43038 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9bee0589fb
commit
f04d84149f
@ -155,6 +155,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
|
||||
'capabilities' => $post_type->cap,
|
||||
'description' => $post_type->description,
|
||||
'hierarchical' => $post_type->hierarchical,
|
||||
'viewable' => is_post_type_viewable( $post_type ),
|
||||
'labels' => $post_type->labels,
|
||||
'name' => $post_type->label,
|
||||
'slug' => $post_type->name,
|
||||
@ -223,6 +224,12 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'viewable' => array(
|
||||
'description' => __( 'Whether or not the post type can be viewed.' ),
|
||||
'type' => 'boolean',
|
||||
'context' => array( 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'labels' => array(
|
||||
'description' => __( 'Human-readable labels for the post type for various contexts.' ),
|
||||
'type' => 'object',
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9.6-alpha-43037';
|
||||
$wp_version = '4.9.6-alpha-43038';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user