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.


git-svn-id: https://develop.svn.wordpress.org/trunk@49492 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Robert Anderson
2020-11-04 01:03:22 +00:00
parent 4ddaf4b5df
commit d72c668d55

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