Skip to content

Add ability to restrict the list of allowed inner blocks to core blocks #35966

Closed

Description

@fabiankaegy

What problem does this address?

When working with custom blocks there are examples of blocks like for example a custom image carousel that should never be allowed within a core cover block. Or a custom grid block that should not be inserted in a column block. This currently is not possible.

What is your proposed solution?

Either adding a filter in the core blocks that allows you to use the wp.hooks.addFilter function to modify the list of allowedBlocks passed to the inner blocks component within the core blocks.

There also is an old proposal here: #16560 that feels very similar that would add the allowed inner blocks to the blocks attributes / supports.

Activity

  1. added
    [Type] Enhancement
    [Feature] Extensibility
    [Package] Block library
    on Oct 26, 2021
  2. fabiankaegy commented on Nov 5, 2021

    @fabiankaegy
    MemberAuthor

    This appears to be resolved for the Core Column block as of #35342 and the Core Cover block as of #31326

  3. madfcat commented on Jul 30, 2023

    @madfcat

    Yes. But what about adding restricting blocks on core/quote author field? You can add anything there.
    const quote_metadata in block-library.js does not have allowedBlocks field, hence I can not even use addFilter hook.

  4. fabiankaegy commented on Jul 31, 2023

    @fabiankaegy
    MemberAuthor

    @madfcat I'd encourage you to open a specific issue for that block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Extensibility[Package] Block library[Type] Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions