-
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
Image: Add the ability for a plugin to disable Image Editor #23966
Conversation
Size Change: +690 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
2c1e240
to
844e5c8
Compare
Adding variables to the global ( An alternative might be to use a data store to configure this type of thing. I haven't thought through all the implications of that, but a config store might be a way of exposing pretty granular configuration to the site. What's the handling like for experimental features? Could it be used to handling configuration of some more regular features? |
The experiments page settings live in the |
@@ -131,6 +132,9 @@ export const SETTINGS_DEFAULTS = { | |||
{ slug: 'full', name: __( 'Full Size' ) }, | |||
], | |||
|
|||
// Allow plugin to disable Image Editor if need be | |||
disableImageEditor: false, |
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.
What's if it's the opposite: imageEditing: true
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.
It looks like the other block-editor settings use disable
for example custom colors, font sizes, and gradients. I followed their lead on that.
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.
These things may change once global styles is here. imageEditing allow for potentially having a more advanced config later (object).
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.
@youknowriad I'm fine with switching. Is it ok to create it as imageEditing
and keep it as a boolean, defaulting to true
?
We would then be changing its type down the line if we add settings, but setting to false would work. If create it as an object, it will be empty to start, which is falsey, so tricky to test for disabled.
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.
Seems to work as intended 👍
854dba6
to
ccb12e1
Compare
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.
Thanks! I tested and this is working well. It makes sense to allow this more complicated feature to be disabled.
I'm not as familiar with the settings and don't have much opinion on the naming. I'm happy to let you and @youknowriad make a decision (#23966 (review)).
Ok, I've updated to use the I think this should be back ported to WP 5.5 so it goes out with the release in case any one needs to disable. |
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.
I've retested and this works well 👍
Is there a dev note planned for the image editing feature? in which case, this should probably be mentioned there? |
Description
This adds the ability for a plugin to disable the new Image Editor tools, so if it is a feature they do not want to offer, or does not work then it can be disabled programmatically.
Uses the block-editor settings store to disable.
How has this been tested?
Apply PR and confirm no change, everything works as expected (default does nothing different)
Try disabling, add a simple plugin that includes something like the following and confirm the new image editing tools are disable as expected. Additionally confirm other image features still work as expected.
Types of changes
Disables Image Editing tools by checking if block-editor settings has been set to false.
Checklist: