-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
inherit templateLock in column block #23329
Conversation
ping @jorgefilipecosta since you provided feedback on my first PR (edit: just noticed you're on leave though :) ) |
So apparently the e2e tests are reflecting the opposite behavior (#22115). At least @jorgefilipecosta showed some interest in this behavior earlier #17301 (review). What do others think? |
My use case for having it locked is that I can lock site editors to a predefined template. Currently columns are an exception to this. All other blocks become locked from the post template (groups, media-text, covers etc). |
c10bbbb
to
2f0757b
Compare
9c58476
to
ba9a774
Compare
Hi @oxyc thank you for proposing a new simpler solution to this issue. It seems like it would make the column inside columns inherit the locking from parent blocks (or the CPT) this would make column consistent with what happens with the group. |
So the question to answer is whether we think applying a "lock" at the global level should inherit or not in the column block. So what I wonder is whether instead of having locking inheritance built-in into InnerBlocks, we could remove the inheritance and add a |
Yes, a templateLock attribute would allow full control in parent blocks. At the time, we did not follow this path because we were avoiding the addition of attributes that don't change anything at all on the block output, that's why we also discussed things like block options similar to attributes that just affect the edit of a block but not the output. None of the solutions discussed gained traction, and meanwhile, we used the placeholder attribute in more blocks, so I guess a template lock attribute would be a possible solution. |
Currently you can only do this for columns blocks though, not group. Which is a bit inconsistent. Worth seeing the original issue #17262 where expected behavior was the opposite from my own expected behavior.
This would serve everyone much better for sure. |
In that case, I guess we can go for the attribute approach @youknowriad suggested and totally remove the inheritance mechanism? |
Also related: #8112. It'd also be good to consider use cases in patterns regarding locking. Also, if locking becomes an attribute, it should probably be exposed in the "Advanced" settings as a toggle, so that you can build patterns with parts of it locked. The presence of such UI should probably support permissions / capabilities. It might also get tricky with direct HTML editing, but that is already the case with any locking system — the attribute might actually help reconcile or discard changes since it leaves a trail in history. |
Hi @oxyc, @mtias, @youknowriad, It seems the steps to close this issue are:
And I can propose an implementation following this logic. Users would be able to remove the locking set by CPT template, patterns, or parent blocks, using the advance panel. Is this something we accept? |
I'd imagined that initially this attribute won't have any UI, more like the current "placeholder" attribute. Something developpers can use in their templates to control the locking behavior. |
Given that #26128 has been merged, can this PR be closed now? |
yes, let's do that. |
Description
Second take on #17301 since #20465 was merged. As described in #17301 and #17262, when having
template_lock = 'all'
on a post template, the column blocks are not locked and allow any block to be inserted.Now that the columns block doesn't explicitly set a
templateLock
the fix to inherit the locking settings seems to be as easy as removing the override in the Column block.How has this been tested?
post
post type.Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: