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.
Just wondering if this works with Breakpoints or Picture/Breakpoints to download smaller images based on screen size?
Comment | File | Size | Author |
---|---|---|---|
#22 | interdiff_18-22.txt | 1.33 KB | CRZDEV |
#22 | field_group_background_image-convert-multiplier-to-integer-2502001-22-D7.patch | 12.46 KB | CRZDEV |
Comments
Comment #1
Pere OrgaNo, it does not.
But could be implemented. Patches welcome :)
Comment #2
tchopshop CreditAttribution: tchopshop commentedYes, I just tested with Picture and saw that it didn't work. I've looked through all the other background related modules and no one else is doing it either but since I'm not a developer, I can't make it happen, unfortunately. Ugh.
Comment #3
tchopshop CreditAttribution: tchopshop commentedActually just discovered that the Makeup module works with Breakpoints as a field formatter. I think implementing with Picture might be better, but it's pretty good.
Comment #4
Pere OrgaHmm, I've thought about it and now I don't see how we could use picture elements. This module does not insert html elements such as
<img/>
, but uses inline styles instead to display backgrounds.Apart from that, note that you can use the srccet attribute in
<img>
tags, and that may be better than using<picture>
. See http://www.smashingmagazine.com/2014/05/14/responsive-images-done-right-...Comment #5
tchopshop CreditAttribution: tchopshop commentedThe Makeup image module basically uses a field formatter to write css media queries in a stylesheet (or inline) for the background image using different image cache sizes and breakpoints from breakpoint module. I could write my own media queries in my style sheets but I wanted to make use of imagecache to create the various image sizes.
Comment #6
Pere OrgaI see what you mean now.
Comment #7
tchopshop CreditAttribution: tchopshop commentedGreat... Just in case you're interested in working on it... the picture module would be even easier, since it's a grouping of breakpoints, rather than having to do all the breakpoints and image cache associations all over again inside the field settings.
I just checked out your module contributions... some cool ones I hadn't heard of!
Comment #8
trackleft2 CreditAttribution: trackleft2 as a volunteer and commentedThis patch adds picture module support.
I stole a bunch of code from https://www.drupal.org/project/picture_background_formatter So we may be able to combine the two projects.
Comment #9
joegraduateThis should probably either be changed to
* @see field_group_background_image_field_group_pre_render()
or removed.This should be changed to
* @see field_group_background_image_generate_background_css()
.Coding standards nitpick: extra newlines should be removed.
Comment #10
trackleft2 CreditAttribution: trackleft2 as a volunteer and commentedThanks @joegraduate, I'll re-roll with your suggestions. Probably also need a database update in this one for the formatter_type change.
Used to be
open
and now changes toimage
andpicture
Comment #11
trackleft2 CreditAttribution: trackleft2 as a volunteer and commentedBTW I also tried the
switch case
method for the settings form, as shown here: https://www.drupal.org/node/1017962 under hook_field_group_format_settings but the form api #states functionality worked better. Would rather use the switch case method, since it affects what is shown in the field_group settings when you save them on the entity field display page.Problem is, my settings variables don't ever get set using the switch case method.
Comment #12
trackleft2 CreditAttribution: trackleft2 as a volunteer and commentedHere are the changes suggested by @joegraduate
Comment #13
trackleft2 CreditAttribution: trackleft2 as a volunteer and commentedTesting on a fresh install I found some issues. Patch rerolled to handle them.
Comment #14
ShaneOnABike CreditAttribution: ShaneOnABike at Bees on a Bike commentedOh man! This is exactly what I've been needing to properly integrate some picture/breakpoint configurations. I have tested it and it works amazingly! Responsive exactly as I needed yahoo!
Can we port this into the actual project!
Comment #15
ShaneOnABike CreditAttribution: ShaneOnABike at Bees on a Bike commentedOkay I found one gotcha! Presently, this doesn't work with ajax loader on views. If I enable that on say the pager then the next set of images aren't loading properly. Why? Because the add_css call that is being made doesn't add the css background image :/ I am not sure whether we need a special ajax callback function to inject more css (or even if that's possible at all)
Comment #16
trackleft2 CreditAttribution: trackleft2 as a volunteer and commentedI've been getting this error Notice: A non well formed numeric value encountered in field_group_background_image_generate_background_css() on php7.
Comment #17
trackleft2 CreditAttribution: trackleft2 as a volunteer and commentedComment #18
omarlopesinoHi.
This patch works greats for picture, thanks!
We add a patch which do the following improvements:
- Solve problem for #10, allowing it to work with old config. This save work when updating the module.
- Fix a warning when showing background image for images, not for pictures:
Notice: Undefined property: stdClass::$field_name en field_group_background_image_field_group_pre_render() (line 210...
Please review, thanks!
Comment #19
omarlopesinoComment #20
trackleft2 CreditAttribution: trackleft2 as a volunteer and commentedThe patch in #18 works for me thanks! RTBC IMHO
Comment #21
CRZDEV CreditAttribution: CRZDEV at Metadrop commentedHere goes a new patch adding possibility to alter used url, made here as we need this changes (using breakpoints & picture).
This is mainly to allow other modules alter image url (to add invalidating cache params for example).
Comment #22
CRZDEV CreditAttribution: CRZDEV at Metadrop commentedAdding new files renaming drupal alter function according to module name.
Comment #23
Pere OrgaApologies for not having reviewed nor tested that, I no longer use this module in Drupal 7 myself. A review by others would help too.
Missing space after
if
and after('picture'))
.Not sure why 'open' is removed here. Ideally, having the Image module enabled should not be required (even if 99.9% of Drupal sites have it).
Should
field_group_background_image_generate
have a better name? AFAIK it should refer to the data being passed.Comment #24
Pere OrgaComment #25
AstonVictor CreditAttribution: AstonVictor at DevBranch commentedI'm closing it because the issue was created a long time ago without any further steps.
if you still need it then raise a new one.
thanks