backdrop-contrib / photoswipe

Photoswipe jQuery-based lightbox photo gallery.
GNU General Public License v2.0
2 stars 3 forks source link

Support custom captions (with tokens) #31

Open djzwerg opened 3 years ago

djzwerg commented 3 years ago

Like the Colorbox module or Photoswipe for Drupal it would be very nice to have custom caption support.

korontari commented 3 years ago

@djzwerg , could you explain a bit what custom captions you mean? Right now the Photoswipe module supports text fields as captions. For instance, if you create your custom content type with an image and a text field, you then can then set that text field as a caption in Photoswipe image formatter. Another example, if you are using Views to set up a gallery, then you can add an image and any text field to Views fields and set that text field as caption for Photoswipe image formatter. Let me know if this is what you want or if you have any questions.

djzwerg commented 3 years ago

@korontari PhotoSwipe for Drupal 8 supports custom captions: grafik

grafik

korontari commented 3 years ago

I understand. This would be great to have. In a more global sense having text fields that support tokens would make these captions possible without any changes to Photoswipe module.

djzwerg commented 2 years ago

Hi @korontari do you think it is possible to this feature within photoswipe?

korontari commented 2 years ago

Hi @djzwerg! I think it is possible, but I personally have not dealt with tokens yet and this is not something I can implement quickly. I will look into it once I have time, just can't promise that.

korontari commented 2 years ago

@djzwerg , on a side note, if you can organize a gallery of images via views, then you can arrange output of the node fields into a custom caption (in a similar fashion as in your example) via "rewrite result" and "replacement patterns" functionality.

image

The problem with Photoswipe module though, is that it reads fields output before the rewriting occurs. But this can be fixed relatively easy (I think I can fix that at least). For now you can check my Glightbox module as alternative. It may not be that good in performance as Photoswipe, but at least it reads the fields with "rewrite result" enabled and you can check if that approach works for you.

djzwerg commented 2 years ago

Thanks @korontari I will try both.

djzwerg commented 2 years ago

@djzwerg , on a side note, if you can organize a gallery of images via views, then you can arrange output of the node fields into a custom caption (in a similar fashion as in your example) via "rewrite result" and "replacement patterns" functionality.

As I can see this is no possible solution because you have to chose one of alt tag, title tag or node title: grafik

digitaldoctrine commented 11 months ago

I have a Post content type with an image field which can hold multiple images. Another node text field can’t store all the captions. ALT text is not for captions, it’s for describing the image to the visually impaired or when the image cannot not load (but you knew that already). Backdrop warns you not to use the Title field because of issues with screen readers. And anyway, a Title is not a caption either.

Is it possible that Image Field Caption might provide a solution? It would be fairly easy to test for and it includes Views support too.