-
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
Compat: Conditionally filter editor settings for image dimensions #20939
Conversation
Size Change: -118 B (0%) Total Size: 857 kB
ℹ️ View Unchanged
|
`is_array` still warns if not set. Coincidentally helps avoid an unnecessary call to wp_get_registered_image_subsizes when there's no sizes to work with. One difference is that imageDimensions would not be set unless imageSizes is non-empty. But if the idea is for imageDimensions to be dependent upon imageSizes here, it's a sensible caveat.
Resolves lint errors
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.
Looks good - works with EditorsKit, tested with WP 5.4 RC2 & 5.3.2.
I'm not sure if the failing test is related, but otherwise 👍
It's not one of the common intermittent failures, and seems like it ("Image block") is in the same realm of the changes here 🤔 I'll give it a look. |
I wasn't able to reproduce the failure locally, and it passes after I restarted the build on Travis. I assume then it was just a flakey test. |
Fixes #20907
Previously: #17151
This pull request seeks to move
gutenberg_extend_settings_image_dimensions
tocompat.php
, considering it as a temporary backporting of behavior otherwise assumed to be handled by WordPress 5.4.0+ (i.e. to support WordPress 5.3.x). In doing so, it makes the implementation more durable by only extending the settings if (a)imageDimensions
is not already assigned and (b) the given settingsimageSizes
is an array.Testing Instructions:
Repeat Steps to Reproduce from #20907, verifying that no warnings occur.
Repeat Testing Instructions from #17151, ideally both in WordPress 5.3.2 (where the extension will apply) and WordPress 5.4.0 RC2 (where it is not needed).