Skip to content

Inconsistent behaviour when using group and columns block with template_lock = 'all' #17262

Closed
@Retrofitterdk

Description

Describe the bug
It looks to me like the columns block and group block are treated differently, when added to a block template and using template_lock = 'all'

It seems like it’s possible to add innerblocks to the columns block, but not to the group block. Strangely enough it seems possible to add inner blocks to the group block, when it itself is added inside a column.

I’m uncertain whether this is a bug or intended behaviour, but if intended it seems like inconsistent behaviour to me.

(It is also very possible, that I’m just not creating the block template in a correct manner.)

To reproduce
Steps to reproduce the behavior:

  1. Create a block template with both a column block and group block.
function myplugin_register_template() {
  $post_type_object = get_post_type_object( 'post' );
  $template = array(
    array( 'core/columns', array(), array(
      array( 'core/column', array(), array(
        array( 'core/group', array(), array(
          array( 'core/paragraph', array(
            'placeholder' => 'Add a inner paragraph'
          ) ),
        ) ),
      ) ),
      array( 'core/column', array(), array(
        array( 'core/paragraph', array(
          'placeholder' => 'Add a inner paragraph'
        ) ),
      ) ),
    ) ),
    array( 'core/group', array(), array(
      array( 'core/paragraph', array(
        'placeholder' => 'Add a inner paragraph'
      ) ),
    ) ),
  );
  $post_type_object->template = $template;
  $post_type_object->template_lock = 'all';
}
add_action( 'init', 'myplugin_register_template' );

  1. Create new post
  2. Successfully try to add new inner block in a column
  3. Unsuccessfully try to add new inner block in the group block

Expected behavior
i would expect that both group and columns block are treated like containers that has their own setting for adding inner blocks, and that they would both allow innerblocks to be added regardless of the template settings.

Screenshots
GroupColumnsTemplateLock

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Safari
  • Version 12.1.2

Additional context

  • Gutenberg 6.4.0

Metadata

Assignees

Labels

[Feature] Nested / Inner BlocksAnything related to the experience of nested/inner blocks inside a larger container, like Group or P[Feature] Templates APIRelated to API powering block template functionality in the Site Editor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions