Closed (fixed)
Project:
PhotoSwipe - Responsive JavaScript Modal Image Gallery
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Apr 2018 at 21:44 UTC
Updated:
10 Jan 2019 at 17:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
chucksimply commentedComment #3
Kunstwirt commentedDid you find a solution in the meantime? We are looking for a similar thing, but mainly for a way to display captions next to the thumbnails (maybe we disabled something by accident?). Thanks, Frank
see also my request: https://www.drupal.org/project/photoswipe/issues/2984783
Comment #4
anybodyI think paid development might be an option here, if you can't develop a patch inhouse. Perhaps someone is interested?
Comment #5
chucksimply commentedIf anyone wants to provide an estimate to develop this feature, maybe we can chip in to get it done. This really is a huge missing piece, and would push this module to the next level.
Comment #6
marassa commentedI added an option of a custom caption with tokens, just like in the Colorbox module. It's actually more flexible than using one views field as you can combine more than one field and add your own markup if needed. If you only want one field, just use one token, like [node:body].
There seems to be some work in progress in 8.x-2.x-dev that kind of breaks some of functionality working in the 8.x-2.2 release. So I am going to post two patches: one will apply to 8.x-2.x-dev (to be hopefully committed one day) and the other will apply to 8.x-2.2 - for those who run the release version and need this right now. Please review and test.
Comment #7
marassa commentedComment #10
marassa commentedRe-posting the same patches to be tested against correct version (and not tested at all in case of the 8.x-2.2 patch). Could not figure out how to change that without re-posting.
Comment #11
marassa commentedComment #13
marassa commentedComment #14
marassa commentedAdded a couple of enhancements:
- a text field is way too small for a good fat caption using lots of tokens; changed to textarea
- made sure the token replacer respects the current page language
Comment #16
chucksimply commentedAwesome... will test out this week and report back. Thank you for this work!
Comment #17
chucksimply commentedTested the 8.2.2 release patch... works beautifully. The token solution is by far the most flexible + versatile. Thank you again... I feel like this was a subtle but pretty major missing piece.
Comment #18
anybodyThank you very much, should a token browser link (AJAX) be added perhaps? Eventually in the field description?
Two more questions:
1. Where does the output filtering and token replacement happen? I couldn't find that in the patch. It's also important for security reasons.
2. Can you please explain this change? Isn't that supposed to break other things?
Comment #19
marassa commented@Anybody:
I'm not sure I understand the question - do you mean the list of available tokens? It's right there, under the Custom caption field.
In photoswipe.theme.inc:
Sure: I initially based my code on 8.x-2.2 where the entity is obtained by the double getParent() call. It works for me (and apparently for the other 1207 people who use the module with Drupal 8). When I tried to create a "proper" patch against dev, I noticed that the double getParent() call has been replaced by a single getParent() there which is probably very good for the Media use case but totally breaks everything when you work with simple image fields in simple nodes.
The change in dev was introduced by https://www.drupal.org/project/photoswipe/issues/2977943 - I linked it to this issue and made a few comments in that issue, including a proposed patch that does away with all this getParent() monkey business. My patch and whatever is done under that issue should be somehow merged together so that the module works with both Media fields and simple image fields.
Comment #20
anybodyThank you very very much for your clarification, @ndlarge!
1) Sorry then it's my mistake, I couldn't find that piece in the code.
2) Ok... yes I'm also quite unhappy with the current state... would you like to help me clean up and become co-maintainer of this module? I was also only a "helper" in fixing several problems. That would be great!
Of course we should ensure everything works as expected in all cases... What about writing tests in the next step? Meta-issue? Would you be interested?
Comment #21
marassa commented@Anybody:
I am flattered by your co-maintainer proposal but I'm afraid I'm not qualified/experienced enough to maintain a popular module like this (for example I have no idea how to write tests, I am not too fluent in git etc etc etc) and last but not least I don't have the time it would take. I simply wanted Photoswipe for the only site I am developing for myself, found a few shortcomings, did some copying and pasting, was satisfied with the result and decided to share it with the community. I am more than happy to share what I developed and what works for me but I am hardly able to clean up other people's code dealing with stuff (like Media) I have no clue about.
Maybe @Niklan would be interested in reconciling media and non-media use cases? He is much more experienced than me.
Comment #22
anybodyThank you ndlarge for your honesty, we'd really appreciate some more help. Then back to topic!
Comment #23
anybodyRetest against latest dev after #2977943: Support Media and Entity References was committed to dev.
Comment #25
anybodyThe patch needs a reroll against the latest dev now. Thanks!
Comment #26
marassa commentedPatch rerolled against the latest dev. Works for me with image fields in entity display and views contexts, didn't test with Media!
Comment #27
marassa commentedComment #28
marassa commentedComment #31
anybodyThank you all. This is now in the latest 8.x-2.x dev release. Please test!