Compat: Conditionally filter editor settings for image dimensions#20939
Merged
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
ryelle
approved these changes
Mar 17, 2020
Contributor
ryelle
left a comment
There was a problem hiding this comment.
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 👍
Member
Author
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. |
Member
Author
|
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. |
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #20907
Previously: #17151
This pull request seeks to move
gutenberg_extend_settings_image_dimensionstocompat.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)imageDimensionsis not already assigned and (b) the given settingsimageSizesis 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).