From 4be65decb710c25bc5407e8f1a16a5a888ae15b9 Mon Sep 17 00:00:00 2001 From: noisysocks Date: Wed, 4 Nov 2020 01:05:10 +0000 Subject: [PATCH] Editor: Add explicit template and template_lock attributes Add and document the template and template_lock attributes on WP_Post_Type that are used by the block editor. Props metalandcoffee. See #46261. Built from https://develop.svn.wordpress.org/trunk@49492 git-svn-id: http://core.svn.wordpress.org/trunk@49251 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-post-type.php | 33 ++++++++++++++++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-post-type.php b/wp-includes/class-wp-post-type.php index db2eb6b47d..afe8eaeb46 100644 --- a/wp-includes/class-wp-post-type.php +++ b/wp-includes/class-wp-post-type.php @@ -260,6 +260,37 @@ final class WP_Post_Type { */ public $delete_with_user = null; + /** + * Array of blocks to use as the default initial state for an editor + * session. Each item should be an array containing block name and + * optional attributes. + * + * Default empty array. + * + * @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/ + * + * @since 5.6.0 + * @var array $template + */ + public $template = array(); + + /** + * Whether the block template should be locked if $template is set. + * + * If set to 'all', the user is unable to insert new blocks, move existing blocks + * and delete blocks. + * If set to 'insert', the user is able to move existing blocks but is unable to insert + * new blocks and delete blocks. + * + * Default false. + * + * @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/ + * + * @since 5.6.0 + * @var string|bool $template_lock + */ + public $template_lock = false; + /** * Whether this post type is a native or "built-in" post_type. * @@ -415,6 +446,8 @@ final class WP_Post_Type { 'show_in_rest' => false, 'rest_base' => false, 'rest_controller_class' => false, + 'template' => array(), + 'template_lock' => false, '_builtin' => false, '_edit_link' => 'post.php?post=%d', ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 2db84da633..65233ed39d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-beta3-49491'; +$wp_version = '5.6-beta3-49492'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.