mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
REST API: Add endpoints for blocks.
`WP_REST_Block_Renderer_Controller` allows rendering of server-side rendered blocks, whilst `WP_REST_Blocks_Controller` allows retrieving of reusable blocks. Merges [43805] and [43806] from the 5.0 branch to trunk. Props desrosj, danielbachhuber, pento, Presskopp, swissspidy. See #45065, #45098. git-svn-id: https://develop.svn.wordpress.org/trunk@44150 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -255,18 +255,21 @@ function create_initial_post_types() {
|
||||
register_post_type(
|
||||
'wp_block',
|
||||
array(
|
||||
'labels' => array(
|
||||
'labels' => array(
|
||||
'name' => __( 'Blocks' ),
|
||||
'singular_name' => __( 'Block' ),
|
||||
'search_items' => __( 'Search Blocks' ),
|
||||
),
|
||||
'public' => false,
|
||||
'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => false,
|
||||
'rewrite' => false,
|
||||
'capability_type' => 'block',
|
||||
'capabilities' => array(
|
||||
'public' => false,
|
||||
'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => false,
|
||||
'rewrite' => false,
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'blocks',
|
||||
'rest_controller_class' => 'WP_REST_Blocks_Controller',
|
||||
'capability_type' => 'block',
|
||||
'capabilities' => array(
|
||||
// You need to be able to edit posts, in order to read blocks in their raw form.
|
||||
'read' => 'edit_posts',
|
||||
// You need to be able to publish posts, in order to create blocks.
|
||||
@@ -276,8 +279,8 @@ function create_initial_post_types() {
|
||||
'edit_others_posts' => 'edit_others_posts',
|
||||
'delete_others_posts' => 'delete_others_posts',
|
||||
),
|
||||
'map_meta_cap' => true,
|
||||
'supports' => array(
|
||||
'map_meta_cap' => true,
|
||||
'supports' => array(
|
||||
'title',
|
||||
'editor',
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user