-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Allowedblocks in locked template #18711
Comments
Does this bug describe your issue as well? #11681 |
Thanks for the reply - No. I don’t have an issue refreshing. I simply can’t add any allowed blocks to my container block if template lock is on (and if it is off I can add blocks where I don’t want people to add them...) |
I noticed now that if I add templateLock={false} to my container block, it works as expected. I previously had tried with and without templateLock="false", which I assume caused some error (no blocks could be added; there was no error that I saw). But maybe it should work without any templateLock setting within the container block? And it would be great if errors could be logged. |
Hi @janeschindler, thanks for getting in touch and apologies for the delay in any response. I had a look into it and the reason this is happening is that the This is mentioned in the README file for As such, I'll keep this issue open and it can be about updating the docs. Potentially, error handling for invalid values could be added as well, as you suggest. |
Oh, thanks, I see the note in the readme. It would be great if this could be added to the docs. The locking example in the docs is a php example, and it's not clear to me what the relationship between the locking capabilities there and those directly in JS is. False isn't mentioned, but it might only be relevant for JS. It would be nice of the 'nested templates' section could also talk about how to lock/unlock and how allowed blocks works for nested blocks. And even nicer would be if the locking could be written into the PHP nested templates. Then developers could do a lot with existing blocks without always having to make more JS blocks that just define core innerBlocks and locking constraints, which is what I did. Anyway: The more clarification the better, though I can see that writing documentation is hard and takes a lot of work... thanks for doing it! |
Adds clarity to the documentation concern mentioned here: WordPress#18711
I looks like this should be closed since #27834. |
Note from @talldan: This turned out not to be a bug, but the documentation needs an update, see
#18711 (comment)
Describe the bug
It used to be possible to create a container block with InnerBlocks, with allowedBlocks set there, and page template_lock set to all and the page template set to this container block – this meant that the whole post was locked except inside the container block, where only specific blocks were allowed. But in Wordpress 5.3 this no longer works for me. When I create this situation, I still can't add any blocks, including the explicitly allowed blocks, regardless of whether the block templateLock is set to true or false.
To reproduce
Expected behavior
The post type only allows blocks in the set order defined in the post type; it is not possible to move these blocks. But INSIDE the mycontainer block, the allowed blocks can be moved and added.
Additional context
Wordpress 5.3
The situation I expect is described here:
#12308
But it is no longer working.
My problem is described here:
#12288
But this person no longer has this problem, whereas I do....
The text was updated successfully, but these errors were encountered: