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.
To create a galleries using the Juicebox views style plugin, Juicebox Gallery format requires the field holding the image to be of type image, file or file ID.
There now exists a media management module named Scald where images are added to nodes by means of something called an "Atom Reference" field.
I want to use this field to be the source of the image when using the Juicebox views style plugin.
Comment | File | Size | Author |
---|---|---|---|
#9 | juicebox-use_scald_atom_reference_field_as_image_source-2725279-9.patch | 2.76 KB | gisle |
Comments
Comment #2
rjacobs CreditAttribution: rjacobs commentedHi.
I'm loosely familiar with Scald, though I have not used it on any official projects so the technical details are not all super-clear to me. There are a couple methods within the views style plugin that could probably be updated to support additional sources (assuming the direct source image URLs can be extracted from the rendered view object), but first I wonder if there are any existing alternatives. For example, is it possible to use some form of file relationship on your view to expose the file ids through an Atom Reference field? If so you might be able to setup a view based on Scald data/filters/context that still exposes a field that the Juicebox formatter already knows how to work with. I suppose this depends a bit on the level of views integration offered by Scald.
Comment #3
gislerjacobs, thanks for replying.
I am not too familiar with the Scald internals my self - but I'll look into the alternatives you suggest and report back here.
Comment #4
rjacobs CreditAttribution: rjacobs commentedAny updates regarding the points in #4? I'm just curious if we should keep this open.
Comment #5
gisleThe enclosed patch adds a Scald "Atom Reference" field to the type of fields that can be used as an image source to a Juicebox gallery.
Please consider adding it to the module.
Comment #6
gisleChanging status.
Comment #7
AsadKamil CreditAttribution: AsadKamil at Valuebound commentedHi All,
The patch works fine ,thanks
Comment #8
rjacobs CreditAttribution: rjacobs commentedThanks for sharing this.
A couple questions:
I'm wondering if there is a more precise conditional check that could be used here? I'm not sure if any other modules could add an sid to any non-scald field items but it might be best not to take the risk. At a minimum I suppose we would need a module_exists('atom_reference') check.
Are there any common cases where we might have a broken atom link (as sid without a file object) that needs to be checked for? I don't know scald internals well enough, so it's very possible that this is all fine as-is, I just wanted to check. If we are always guaranteed a file object if there is an sid then could this be reduced to one line?:
Comment #9
gisleSorry about taking so along before returning to this. An revised patch is attached.
I am not aware of any other module that add an
sid
to field-items, but I've added amodule_exists('atom_reference')
check. I can't think of anything else to check for.In scald a
sid
always comes with an associated file object. However, I also want to extract the image title and list of authors (if they exist) and add them to the item, so I need to have the atom object. I've reduced the rest to one line.Please review.
Comment #11
Neslee Canil Pinto