Views Caption? How?

Created on 16 December 2023, about 1 year ago
Updated 29 January 2024, 11 months ago

I added a media reference field in views.
Then i chose "Photoswipe Responsive Responsive"
The images have alt/title

Everything is fine it works, but there is no caption to chose in the formatter.
"data-overlay-title" attribute is just empty.

I need the caption to be displayed above the image

Should that work?

💬 Support request
Status

Fixed

Version

5.0

Component

Miscellaneous

Created by

🇩🇪Germany marcoka

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @marcoka
  • 🇩🇪Germany marcoka

    I did use views "custom rewrite field" to build the markup myself. That works.

  • 🇨🇦Canada jglynn

    What did you put in the rewrite?

  • 🇩🇪Germany marcoka

    Hi. Thats a bit complex. I rewrote the image fields and added a custom textfield.
    Also activate global script include in the settings and added a class to the view. "photoswipe-gallery"

    image

    <a class="photoswipe" href= "{{ field_media_image }}" itemprop="contentUrl"  data-pswp-width="{{ field_media_image__width }}" data-pswp-height="{{ field_media_image__height }}"  title="{{ field_media_image__title }}" alt="{{ field_media_image__title }}" data-overlay-title="{{ field_media_image__title }}">
    

    custom textfield

    <figure itemprop="associatedMedia" itemscope itemtype="https://schema.org/ImageObject">
    {{ field_media_image_1 }}{{ field_media_image }}{{ field_media_image_2 }}{{ field_media_image_3 }}</a>
    <figcaption itemprop="caption description pswp-caption-content">{{ field_media_image_4 }}{{ field_media_image_5 }}</figcaption>
    </figure>

    That results in the following on my site:
    https://www.kopfhoerer-berater.de/test/sony-wf-1000xm5-im-test#image-gal...

  • Status changed to Postponed: needs info 12 months ago
  • 🇩🇪Germany Grevil

    Have you installed the "photoswipe_dynamic_caption" submodule? Since Photoswipe 5.x, different photoswipe functionalities were encapsulated in "photoswipe plugins" (see https://github.com/dimsemenov/photoswipe-dynamic-caption-plugin for example). This is represented through submodules in the Drupal module.

  • 🇩🇪Germany marcoka

    Yes i have. My solution also works and you can customize the code to be valid with the schema.org gallery template

  • Status changed to Fixed 12 months ago
  • 🇩🇪Germany Grevil

    @marcoka, my apologies! Seems, that I haven't read the issue summary correctly!

    Having a caption above the picture isn't currently supported, the caption "type" can currently be set to "below", "aside" or "auto", see https://github.com/dimsemenov/photoswipe-dynamic-caption-plugin#type-auto. Feel free to create an issue on @dimsemenov caption plugin repo.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024