Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
fabiankaegy opened this issue Oct 26, 2021 · 3 comments
Closed
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Comments

@fabiankaegy
Copy link
Member

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.

@fabiankaegy fabiankaegy added [Type] Enhancement A suggestion for improvement. [Feature] Extensibility The ability to extend blocks or the editing experience [Package] Block library /packages/block-library labels Oct 26, 2021
@fabiankaegy
Copy link
Member Author

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

@madfcat
Copy link

madfcat commented Jul 30, 2023

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.

@fabiankaegy
Copy link
Member Author

@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
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants