Problem/Motivation
When displaying images in a Colorbox via Media, Picture doesn't provide options to set the gallery context and it's not possible to get galleries working.
Using the default Colorbox display in Manage File Display allows selecting gallery grouping options:
- Per post gallery
- Per page gallery
- Per field in post gallery
- Per field in page gallery
- Custom
- No gallery
These options aren't available in the Picture display that allows display port.
Using Picture 7.x-1.2+6-dev
Proposed resolution
Perhaps a custom Picture Colorbox is needed to enable these extra settings and enable the use of the gallery.
- Create a new formatter that combines the fields from Picture and Colorbox
- Implement necessary JS changes for the script to handle all the fields set above
I've implemented a mini-module that adds a Picture Colorbox formatter. I've gotten the backend of the formatter working by merging code from Picture and Colorbox to have settings from both.
I'm a bit stuck on the implementation of the theme hooks to implement the frontend part of it so it doesn't currently render correctly.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | picture-colorbox-with-galleries-2138273-17.patch | 13.23 KB | das-peter |
Comments
Comment #1
Nodz commentedComment #2
xaa commentedhi, any progress on this issue ?
Nodz, your module (thanks) can be considered as stable?
Comment #3
khaled.zaidan commentedWow, Nodz, this is a really nice effort (for an important issue!)
What I'm wondering about is why should this be implemented in a separate module?
The colorbox intergration that is already in the picture module, is incomplete, and the ability to group pictures in a gallery definitely needs to be added.
Plus, this would save some time re-implementing the theming of the field!
I'll work on a patch for the module for this... hopefully gets reviewed/committed to for the next release!
Comment #4
khaled.zaidan commentedAssigning to myself :)
Comment #5
khaled.zaidan commentedAlright, I just created a patch against the latest dev version.
It now allows settings for the Picture field formatter same as the module colorbox did. So we can finally use the picture with colorbox and still have the galleries functionality from colorbox :)
Can the module maintainers please have a look?
Cheers,
Khaled
Comment #6
timlie commented#5 Does not completely work for me.
When I set the settings in a view no matter what option I choose for grouping I never can click through the gallery. The title of the gallery is added on the bottom of every picture, so this does work.
Any idea what goes wrong?
Comment #7
attiks commentedThis looks good, not completely tested, only some remarks on coding standard.
use // for the comment
2 spaces, should be 1
missing a dot at the end.
missing a dot.
missing a dot.
comment is too long.
Comment #8
timlie commentedIs there any progress on this issue?
For me this patch did not work completely and I can't figure out in the code why it does not...
Thanks!
Comment #9
espurnesHi I've not tried the patch yet but I have another solution to it. It's much better to have the module working properly than my approach but meanwhile it can be useful.
The idea is to add the rel attribute that groups the images using javascript. I posted the steps in this other post.
You can add the rel attribute with this line of code:
$('a.colorbox-inline').attr('rel', 'myImgGroup');I've used a behaviour to place this line.
For better results I used a custom module to get the nid.
Then I can use the nid in the behaviour
I hope it helps
Comment #10
attiks commentedComment #11
das-peter commentedHere's a new version that addresses the things mentioned in #7 as well as some issues related to the file entity integration (see the interdiff).
Comment #12
das-peter commentedAnother slight change to ensure the form element states work in the file entity file display formatter settings form too.
Comment #13
das-peter commentedDarn, forgot a form element state.
Comment #14
attiks commentedComment #16
jelle_sFixed in latest dev. Thank you for the patch!
Any chance you can write a similar patch for 2.x?
Comment #17
das-peter commentedUnfortunately I don't have a test-env ready for 7.x-2.x.
However, I've manually re-rolled the patch to apply to 7.x-2.x and as far as I've seen it should / could work ;)
Comment #19
jelle_sBrilliant! Just tested it and it works. Committed to latest dev.
I'll write the update functions for both 1.x and 2.x
Comment #21
jelle_sFixed in 1.x and 2.x. Thanks for all the hard work!
Comment #23
das-peter commented@Jelle_S Fantastic! Thank you very very much!!
Comment #25
xaa commentedcould you let me know if this patch has been committed to the 1.5 version, please ?