Views Caption? How?

Created on 16 December 2023, 7 months ago
Updated 29 January 2024, 5 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 6 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 6 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.69.0 2024