-
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
Allow overriding the templateLock of existing blocks #9386
Comments
This issue More versatile templateLock could potentially help with this, though the scope there is much broader. |
Would #8589 work as a solution to problems you described where empty placeholder blocks are causing layout issues in this case? |
@designsimply I'm not sure! When #8589 converges on a solution we can see how it works for us. |
I think it should be explored whether we could override the "templateLock" of existing container blocks, the same we're able to do it for the "template" content. |
At least for Columns/Column blocks,
In the markup below, Columns/Column blocks exist within a group block that has <!-- wp:group {"templateLock": "all","layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:columns -->
<div class="wp-block-columns">
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->
</div>
<!-- /wp:group --> You can see that the Columns/Column blocks inherit the Group block's As far as I know, there is no container block that supports Therefore, I would like to close this issue, but if there is anything I have missed, please comment. |
Is your feature request related to a problem? Please describe.
We're using templates to implement reusable chunks of layout for landing pages. For example, a call-to-action header block with two columns containing heading, text, an image, a button, and some custom styling.
Templates are really powerful and convenient for this purpose, but there are quirks that are causing problems for us:
core/paragraph
block is added, which is not needed for our layouts, and causes issues on the front end.To work around these issues, we're looking at locking all our template blocks for now using
templateLock
. This will reduce the flexibility of the blocks, but will make things much simpler and more predictable for our authors.This works well most of the time. However, when a template contains columns, the columns block overrides
templateLock
locally. This is frustrating, because the extra placeholder paragraph appears again, breaking the layout, and allowing accidental insertion of a template within a template!Describe the solution you'd like
Since we are instantiating the columns blocks (and their children) directly within our template, it seems appropriate that we could instruct them to not allow editing. If
core/columns
had aforceLock
attribute, which inhibited the override, we could set this as needed in our templates.Describe alternatives you've considered
Would love to hear other ideas for how to work around this. Here are some ideas:
core/columns
block.The text was updated successfully, but these errors were encountered: