-
Notifications
You must be signed in to change notification settings - Fork 182
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
Feature Request: Disallow a ACF block to be nested #469
Comments
Good question. After a quick look online, this may be possible by using the If the above doesn't work out, please have a read over this ticket which poses a similar question to the Gutenberg team - there may be some useful solutions there. |
@elliotcondon Thank you for response. This This can be also very helpful in the other way. Is there currently any way to add this Really good thinking on your linked ticket WordPress/gutenberg#7845. It seems this will support in the future. Will ACF stick with it to support this use case as soon as it becomes available? |
@elliotcondon the parent property really works, very nice. Thank you :-)
But it seems there is no possibility to set a block for the "root" document only and to allow only specific block as inner blocks at the moment. |
|
@Log1x Thank you, yes here we can set the allowed blocks for a specific inner block. Thats really great. But things like to allow a block only on the root first level is missing at the moment. But it seems this will come to Gutenberg. My main question here, is how we can restrict a specific block in the main way on acf_register_block_type(), like this:
So we could define, this block is strictly not nestable. I don't know if something like that comes to Gutenberg in the future. |
Hey @elliotcondon
it's possible to set an option to acf_register_block_type() to disallow a ACF block can be nested?
In some cases this can be very helpful to set restriction for the user. Because the user is very free to add all ACF blocks as an inner block.
I my case I have builded a header block with ACF, which is always placed on the top outside of the content. But there are other cases, if disallowing to be nested can be very helpful.
Are there any ways I can do this using the Block API?
Something like that?
And also helpful can be to avoid the nesting of an ACF block to specific wrapper blocks, like this:
or
I think the last way, should be the best way corresponding to the following filter:
add_filter( 'allowed_block_types', 'my_function', 10, 2 );
The text was updated successfully, but these errors were encountered: