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
This commit is contained in:
noisysocks 2020-11-04 01:05:10 +00:00
parent 107f669f15
commit 4be65decb7
2 changed files with 34 additions and 1 deletions

View File

@ -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',
);

View File

@ -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.