-
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
columns block: add support for templateLock attribute #49132
columns block: add support for templateLock attribute #49132
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @sque89! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, @sque89!
As far as I have tested, everything is working as expected. Personally, I think it would be good to also add e2e tests on template_lock
for the column block, as is already done in the group block, but can be addressed as a follow-up PR.
The following is my test in this PR:
Apply templateLock="all"
to core/columns
block
- Should not be able to change the number of columns, add, delete, or move
core/column
block - The UI to change the number of columns should not appear
- should not be able to insert a block inside
core/column
block
templateLock_all.mp4
Apply templateLock="insert"
to core/columns
block
- Should not be able to add, delete
core/column
block - Should be able to move
core/column
block - The UI to change the number of columns should not appear
- should not be able to insert a block inside
core/column
block
templateLock_insert.mp4
Apply templateLock="contentOnly"
to core/columns
block
- Should not be able to change the number of columns, add, delete, or move
core/column
block - The UI to change the number of columns should not appear
- Should only be able to edit the content within
core/column
block
templateLock_contentOnly.mp4
Apply templateLock=false
to core/columns
block, Apply templateLock="insert"
to parent group block
- Should not be able to delete the
core/columns
block in the group block - Should be able to move the
core/columns
block in the group block - In the
core/columns
block, all operations should be possible.
templateLock_to_group.mp4
Congratulations on your first merged pull request, @sque89! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
What?
Add templateLock attribute and pass it into the innerBlockProps. fixes #48620
Why?
Theme developers can control the content editors abilities to create blocks with the InnerBlocks template and templateLock attribute. But currently it is not possible to reset the templateLock on a core/columns block, which prevents the editor from duplicating an existing column
How?
By adding support for the templateLock attribute to the core/columns block, the developers has a finer control over locked templates.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast