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.
Bynder now supports DAT https://support.bynder.com/hc/en-us/articles/360018559260-Dynamic-Asset-...
This issue is to implement that into Drupal and also to allow to use DAT for responsive images.
Comment | File | Size | Author |
---|---|---|---|
#8 | 3218684-8-conditional-visibility.patch | 7.26 KB | mathilde_dumond |
#8 | 3218684-8-7-interdiff.txt | 2.8 KB | mathilde_dumond |
#7 | 3218684-7-DAT-support.patch | 6.35 KB | mathilde_dumond |
#7 | 3218684-5-7-interdiff.txt | 4.31 KB | mathilde_dumond |
#5 | 3218684-4-implement-feedback.patch | 6 KB | mathilde_dumond |
Comments
Comment #2
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentedComment #3
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentedComment #4
Berdirnone of these should have a field suffix in name or label. the one above is the name of a drupal field, these are not.
For the names, maybe dat_query, dat_query_responsive. not sure if we want to prefix responsive_sizes with dat too or not. I guess just responsive_sizes for that is fine.
a URL placeholder should use:, I think it is also more common to use _ instead of -, if you look at examples in core?
Maybe start the description with an explanation that if this and the next field is filled out, then an responsive image is generated?
Maybe append (srcset) to the title?
I'd leave out the " for parsing" and also the "Write here the info about". Just "The different images..", other than that, good description.
don't forget to update the field stuff everywhere then. In the UI, maybe use "DAT configuration" or so instead of field or attribute. Because neither is accurate? (it is "Alt attribute field" because it is the name of the field that is used for the alt HTML attribute. no attribute involved here beside image src) We could also not display the derivative: DAT part and display this instead. Saves one bogus line in those often very verbose summaries.
And for responsive, I think it's way too much info to display all the responsive image stuff, so we could just add a line that says "With responsive image configuration" or so if both are not empty.
some coding standard issues here. empty line between first line and first @param. $thumbnails is missing the type (also array).
Actually unsure if we really need to pass in settings. We could access it through $this->getSetting('thumbnail') here.
missing param and return here and . at the end of the sentence. but read next comment first and lets finalize the API before documenting it.
Both settings need to be non-empty or we shouldn't add it.
like in the other method, transformBaseUrl also needs to be set. So a single if with 3 checks.
I'm not 100% convinced yet that the two additional methods are really worth it. We need to add quite a bit of lines for documentation and only use both of them just once. Agreee that it does make it easier to read. in the viewElements() method though. but it's a strange mix of setting some things in a method and then directly below, we set #title directly.
I'd actually suggest to just keep both inline, but happy to discuss.
Either way, the parsing is a bit fragile, if someone doesn't add a ", " for example, then it wouldn't work.
I idea for using , already in the configuration was to skip parsing it completely and just do a str_replace('io=', $base_url . '?io=' of the whole string once. That does make the assumption that each configuration must begin with "io=", but that might be OK?
huh, what's in those, don't see this being used? really necessary or some testing leftover?
Comment #5
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentedHere is the new patch with all your feedback -- thanks!
Comment #6
BerdirThanks, another round of nitpicks.
The last part about this being ignored is not correct, it's not. It's still added as the regular image on the img, which means it is the fallback image, we should write that. Also seems to be missing a . as that should be a new sentence? I'd suggest to duplicate the #states definition for 'required' as well, then it will at least be validated in the browser to be required (not 100% safe, in a frontend form we'd need server validation too, but doesn't matter here).
Maybe put the support URL into a variable above so we can reuse it. If it changes in the future, we need to update it in one place only.
What I meant is putting the "Derivative: @style" into the else of thumbnail == DAT, so we don't show Derivative: DAT *and* DAT configuration, only one or the other. And then first in the summary, above title/alt.
And since dat_query is then required, although not strictly validated (#states is just browser validation, you could work around it, but it's good enough for this backend setting), we don't need the incomplete case.
And, one last @field to replace, should be @dat or @dat_query instead.
What I'd suggest for the responsive case is either "Responsive DAT configuration: @dat" or "DAT configuration: @dat, responsive" (@field is then the fallback but gives a hint maybe at what it is).
Comment #7
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentedI took care of all your feedback, thanks again :)
Comment #8
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentedFixed the form fields visibility.
Comment #10
BerdirTested and approved, committing.