Follow-up to #2260061: Responsive image module does not support sizes/picture polyfill 2.2
Move fallback image to the responsive image style, this way the fallback can be defined in the config of the theme and the site builder only has to select the mapping on the display formatter.
Theme builders should be the ones who decide what the fallback image style should be, this means the fallback image style for a responsive image style should be defined in config. It also makes a lot more sense to use the same fallback image style for all <picture> tags that are output using the same responsive image style (either by using '#theme' => 'responsive_image' or the field formatter). So logically the fallback image style should be defined on the responsive image style (vs on the field formatter settings as it is now).
Beta phase evaluation
| Issue category | Task |
|---|---|
| Issue priority | Major because it highly increases the DX for themers, and UX for site builders using responsive images. |
| Prioritized changes | The main goal of this issue is usability and user experience. This is also further cleanup after the larger cleanup in a recent critical change: #2260061: Responsive image module does not support sizes/picture polyfill 2.2. |
| Disruption |
May be disruptive to a small number of beta sites. Any effects on core systems are addressed in this patch, and there are no known contributed modules this would affect. As of April 20, 2015, there are roughly 250 public beta sites. Responsive images module is not enabled by default, so a smaller number of those sites could be using responsive images. Those sites would need to add a fallback style to their responsive image mappings, rather than defining it in field formatters. Because multiple fields could use the same responsive image mapping, defining the fallback image style separately on each field, an upgrade hook might be difficult. Providing a BC layer might be possible, but that seems like a significant amount of technical debt for a small number of sites. The benefits of this change outweigh the disruption, as it allows fallback styles to be defined in one place rather than in many places, which is a big simplification for the much larger number of sites that may use this in the future. |
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 2349461-27-responsive-image-fallback.patch | 19.92 KB | jelle_s |
Comments
Comment #1
attiks commentedComment #2
wim leersFallback image style, right?
P.S.: wow, that's a huge amount of tags :D
Comment #3
attiks commentedRemoved some tags
Comment #4
wim leersLet's get this done?
Comment #5
attiks commentedGreat idea, Jelle?
Comment #6
jelle_s;-)
Comment #7
jelle_sComment #8
wim leersCould only find one nitpick :) Leaving at NR so others can review too.
Would be great to update the IS in two ways:
$this->t()
Comment #10
jelle_sNew patch. Fixes the nitpick from #8 and fixes the failing tests.
Comment #11
jelle_sForgot the interdiff.
Comment #12
jelle_sI did my best at updating the issue summary. I'll have a look at the beta evaluation. I've never written one before so bear with me :-).
Comment #13
jelle_sAdded beta evaluation.
Comment #14
jelle_sComment #15
yched commentedOooh, +1 !
Comment #16
rainbowarrayTook a quick look at the code, and it looks good. Wim gave the thumbs-up, so I think we're good on that front. I'll give it a test to make sure it works.
Comment #17
rainbowarrayTested, and this works fine.
This is going to be a big time saver for people who reuse a mapping in multiple places.
Comment #18
rainbowarrayThis looks RTBC to me. Wim gave the thumbs up on the code, and I'm verifying that this works as tested. I can select a fallback image style as I create a responsive image style. It is editable when I go back to the image style. The fallback selector does not appear on the field formatter on a content type field display tab. And the fallback image shows up properly in a picture element.
Great quick work on this!
Comment #19
webchickAssuming the beta eval is correct, we need a change record draft for this. However, apart from a bunch of stuff in responsive_image module, I'm not seeing a huge impact on any other core modules. Did you manage to do this without breaking BC, or is it only breaking particular types of contrib modules?
Comment #20
rainbowarrayThis would affect modules, themes or sites that are using responsive image styles, since they would define the fallback image style in the responsive image style rather than in the field formatter or through the use of the theme function.
A change record would be good in case anybody is doing that. I'm not aware of contrib modules that are implementing this right now, and it's probably doubtful that there are many themes or sites that are doing so either. This change actually makes it a lot easier for people to make use of responsive image styles, but yes, this is a change.
Comment #21
rainbowarrayIn reviewing https://www.drupal.org/core/beta-changes, I think it's a stretch to call this a disruptive change, and I think the impact is definitely bigger than any disruption.
Comment #22
jelle_sI agree with #21. At first I misread https://www.drupal.org/core/beta-changes#disruption
as
So if nobody objects I'd change this to non-disruptive in the IS.
Are there guidelines somewhere on how to write a change record? I haven't done it before.
Comment #23
wim leersNope, no guidelines. The guideline I use: the information that I'd personally want to be given for a change :)
Comment #24
rainbowarrayHere's a good write-up on how to write a change record: https://www.drupal.org/contributor-tasks/draft-change-record
Comment #25
rainbowarrayUpdating the issue summary to make clear this is not disruptive.
Comment #26
rainbowarrayPatch no longer applies. We need a reroll.
Comment #27
jelle_sRerolled patch, I'll start writing a change record as well.
Comment #28
jelle_sChange record created at https://www.drupal.org/node/2472153
Comment #29
jelle_sComment #30
rainbowarrayMoving this back to RTBC. Beta evaluation updated, change notice posted and patch rerolled. Should be good to go!
Comment #31
attiks commentedCode looks good, and a good looking change record
Comment #32
alexpottTagging because if we were doing beta to beta upgrades this would need a hook_update_N
Comment #33
rainbowarrayComment #34
rainbowarrayEdited the beta evaluation to provide a more accurate assessment of the potential for disruption. Also edited the change notice at https://www.drupal.org/node/2472153 to provide guidance for existing sites that they will need to define a fallback style in their responsive image mappings.
Comment #35
rainbowarrayComment #36
rainbowarrayComment #37
jelle_sRE #32: Not sure an update hook is possible here:
Field instance A can use responsive image style 1 with fallback image style "large".
Field instance B can use responsive image style 1 with fallback image style "medium".
Now that the fallback image style is moved from field instance to responsive image style, how would we update in that case? (See "Disruption" in the Beta phase evaluation as it is explained very well there)
Comment #38
alexpottThis is a followup of the critical #2260061: Responsive image module does not support sizes/picture polyfill 2.2 and it improves the UX of configuring responsive images. Considering that responsive_image is not enabled in standard I think the disruption will be minimal. Because the UX improvement outweighs the disruption - you only have to configure fallback once per responsive image mapping rather than on every field formatter - I think this is acceptable for beta. Committed 7388924 and pushed to 8.0.x. Thanks!
Thank you for adding the detailed beta evaluation to the issue summary.
Comment #40
jelle_sWoohoo! Thank alex! And thanks everyone for the hard work and feedback!
Comment #41
amateescu commentedI'm writing beta9 to beta10 upgrade path functions in the HEAD to HEAD module and I was thinking if at least a minimal implementation would be enough for this issue.
Considering the scenario from #37, how about updating the responsive image style config entity to use the first fallback image style encountered (i.e. of the first field instance), and, in case the following field instances are configured with a different fallback image style just have the update function output a warning message to let the user know that manual intervention is required?
Or is that still too much trouble for no real gain? :)
Comment #42
attiks commentedI think a warning will suffice
Comment #43
rainbowarray@amateescu Sounds like a good plan. Thanks for working on that!
Comment #44
amateescu commentedOk, here it is: #2479801: Upgrade path for #2349461 (move fallback image style configuration). I haven't tested it yet so I'd appreciate a quick look at the patch if anyone has some time for that :)