-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Define allowed inner blocks in register of block type #16560
Comments
I spent on sometime today. What I worked on was the following. Added a new field called In the edit function, I type to get the block type so I could read the innerBlock values and as attributes to Innerblocks. However, it didn't work, as blockType was not yet defined. I wanted to Next port of call, is to make the args to innerblock type filterable. But I don't love this solution. |
Any update to this? |
@chriscasper this is being worked on at #58262 |
Reading @spacedmonkey's notes from 5 years ago, it's notable how much Gutenberg has changed since then. Today it was a very straightforward addition, there's no problem accessing |
This has been merged into trunk with #58262 ; documentation for this is available at https://github.com/WordPress/gutenberg/blob/b48d66e231193dc11978ce6b71f882ee93313ad9/docs/how-to-guides/block-tutorial/nested-blocks-inner-blocks.md#defining-a-children-block-relationship |
As detailed in #13955 there is currently no way to filter the allowed block in a inner block area. Allowed blocks are stored in a none filterable array variable. See these examples.
Even finding which blocks are available requires you to dig through code.
Describe the solution you'd like
The allowed inner block should be defined when the block is registered. A new
children
orinnerBlocks
field could be added when a block is registered. This would mean, that this information would be available to all parts of gutenberg. This data could be exposed in the up coming blocks api, as this data would be useful to the mobile team.Following the naming pattern of
children
would match with existingparent
field for child block, already found in gutenberg.The text was updated successfully, but these errors were encountered: