Make WordPress Core


Ignore:
Timestamp:
11/04/2020 01:03:22 AM (4 years ago)
Author:
noisysocks
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-post-type.php

    r48462 r49492  
    260260     */
    261261    public $delete_with_user = null;
     262
     263    /**
     264     * Array of blocks to use as the default initial state for an editor
     265     * session. Each item should be an array containing block name and
     266     * optional attributes.
     267     *
     268     * Default empty array.
     269     *
     270     * @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/
     271     *
     272     * @since 5.6.0
     273     * @var array $template
     274     */
     275    public $template = array();
     276
     277    /**
     278     * Whether the block template should be locked if $template is set.
     279     *
     280     * If set to 'all', the user is unable to insert new blocks, move existing blocks
     281     * and delete blocks.
     282     * If set to 'insert', the user is able to move existing blocks but is unable to insert
     283     * new blocks and delete blocks.
     284     *
     285     * Default false.
     286     *
     287     * @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/
     288     *
     289     * @since 5.6.0
     290     * @var string|bool $template_lock
     291     */
     292    public $template_lock = false;
    262293
    263294    /**
     
    416447            'rest_base'             => false,
    417448            'rest_controller_class' => false,
     449            'template'              => array(),
     450            'template_lock'         => false,
    418451            '_builtin'              => false,
    419452            '_edit_link'            => 'post.php?post=%d',
Note: See TracChangeset for help on using the changeset viewer.