Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove post type 'viewable' compatibility shim #7496

Merged
merged 1 commit into from
Jun 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions lib/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,39 +365,6 @@ function gutenberg_register_taxonomy_prepare_functions( $taxonomy ) {
}
add_filter( 'registered_taxonomy', 'gutenberg_register_taxonomy_prepare_functions' );

/**
* Includes the value for the 'viewable' attribute of a post type resource.
*
* @see https://core.trac.wordpress.org/ticket/43739
*
* @param object $post_type Post type response object.
* @return boolean Whether or not the post type can be viewed.
*/
function gutenberg_get_post_type_viewable( $post_type ) {
return is_post_type_viewable( $post_type['slug'] );
}

/**
* Adds the 'viewable' attribute to the REST API response of a post type.
*
* @see https://core.trac.wordpress.org/ticket/43739
*/
function gutenberg_register_rest_api_post_type_viewable() {
register_rest_field( 'type',
'viewable',
array(
'get_callback' => 'gutenberg_get_post_type_viewable',
'schema' => array(
'description' => __( 'Whether or not the post type can be viewed', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'edit' ),
'readonly' => true,
),
)
);
}
add_action( 'rest_api_init', 'gutenberg_register_rest_api_post_type_viewable' );

/**
* Gets revisions details for the selected post.
*
Expand Down