-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Edit Widgets: save lock control via actions #69984
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
Conversation
f12edb2
to
4f3aa62
Compare
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@Infinite-Null overall this looks really good. I had some trouble testing, I was getting JavaScript errors on the edit widget screen preventing updates from working, so I couldn't test the actions directly. I am going to try resetting my local (I see the same error on trunk). |
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.
Nice work!
@Infinite-Null The PR description appears to have an error that threw me off in testing. This should be |
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, @Infinite-Null!
This was related to an experiment I had enabled for testing. Once I disabled that, the errors went away and the locking mechanism worked as expected. |
Thanks for the update, @adamsilverstein! |
Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org> Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: jorostoyanov <stoyanovgs@git.wordpress.org>
What?
Add a widget save locking feature. Plugins can add and remove locks and when any locks are present, the update button is disabled.
Closes #33756
Why?
There was no API for developers to lock widget saving, like there was for post saving.
How?
isWidgetSavingLocked
selectorisWidgetSavingLocked
in the widget update buttonTesting Instructions
wp.data.dispatch( 'core/edit-widget' ).lockWidgetSaving( 'mylock' );
wp.data.dispatch( 'core/edit-widget' ).unlockWidgetSaving( 'mylock' );
Screencast:
Screen.Recording.2025-04-30.at.12.32.59.PM.mov