Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps to reproduce:
* create a responsive image mapping
* do NOT select an image style
* view the node - it will throw an exception:
Fatal error: Call to a member function buildUrl() on a non-object in C:\Projects\drupal8\core\modules\responsive_image\responsive_image.module on line 330
Comment | File | Size | Author |
---|---|---|---|
#9 | responsive_image-2349859-9.patch | 6.33 KB | naxoc |
#9 | responsive_image-2349859-9-test-only.patch | 5.15 KB | naxoc |
#5 | responsive_image.module.patch | 1.18 KB | rvolk |
#2 | responsive_image.module.patch | 1.21 KB | rvolk |
Comments
Comment #1
attiks CreditAttribution: attiks commentedComment #2
rvolkCheck this patch with a non-image-style fallback solution.
The default file_create_url function will be used, if the image_style entity is not available.
There is as well a following error fixed in the patch:
Comment #3
mgoedecke CreditAttribution: mgoedecke commentedpatch solves both problems
Comment #4
aspilicious CreditAttribution: aspilicious commentedPut both on 1 line and don't use 'and' we *never* do that in core.
Comment #5
rvolkHere we go... thanks for the advice.
Comment #6
Lukas von BlarerWork for me. RTBC i guess...
Comment #7
webchickLooks like this needs an automated test.
Comment #8
naxoc CreditAttribution: naxoc commentedComment #9
naxoc CreditAttribution: naxoc commentedHere is a test that should catch that.
I'm not sure how many ways responsive image mappings can be created but I think we should make the image style field required on the form?
Also, no interdiff - I only touched the test.
Comment #11
attiks CreditAttribution: attiks commentedTest looks good, back to RTBC
Comment #12
alexpottSo no one seems to have answered the question - should we be able to create mappings without an image style. Looking at the code it seems so since
passing in
TRUE
means we get a none option.Whilst reviewing the code I've realised that ResponsiveImageMappings are missing a dependency on the ImageStyle config entities - created #2383165: ResponsiveImageStyle config entities should depend on the image styles they use
This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 82584e6 and pushed to 8.0.x. Thanks!