Problem/Motivation
In PhotoSwipe 5, the "Photoswipe image caption" option is present on the regular Display page of image fields (on /admin/structure/types/manage/library/display), but the "Photoswipe image caption" option is missing for the same image field in a View.
Drupal core #2686145: Formatter third party settings missing from Views UI is the source of the problem, which needs to get fixed.
It was present in Views, in PhotoSwipe version 4:

Missing in PhotoSwipe, version 5.0.5

Steps to reproduce
In PhotoSwipe 5, create a View, add an image field (media: image), select Photoswipe as the formatter, and at that stage there's no option for selecting a caption type.
In the 4.x version, when Photoswipe is selected as the image field formatter, there is an area available for selecting the caption type.
Proposed resolution
Fix the underlying Drupal core issue #2686145: Formatter third party settings missing from Views UI.
Workaround: Patch Drupal core until it gets fixed:
In PhotoSwipe 5 the "Photoswipe image caption" option is present on the regular Display page of image fields (on
/admin/structure/types/manage/library/display), but missing for the same image field in a View. The solution is Drupal core issue #2686145: Formatter third party settings missing from Views UI, and you can patch Drupal core until it gets fixed.
From https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib...
Remaining tasks
Document the temporary workaround:
- Project page
- README
Documentation page
FUTURE: Remove the temporary workaround when it gets fixed in Drupal core #2686145: Formatter third party settings missing from Views UI:
- Project page
- README
- Documentation page
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | photoswipe4 - caption.jpg | 158.78 KB | jaroslav červený |
| #5 | view photoswipe - no caption select.jpg | 44.3 KB | jaroslav červený |
| #2 | photoswipefield.patch | 930 bytes | jatinkumar1989 |
Issue fork photoswipe-3523410
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jatinkumar1989 commentedfield is not render , need to remove filter
Comment #3
anybodyPlease provide a proper description by filling the issue template:
Comment #4
jaroslav červený commentedWhen you create a view with fields - image fields, there is no option to select a caption.
This option is supported in version 4.
Comment #5
jaroslav červený commentedComment #6
jaroslav červený commentedComment #7
ressaI can confirm this: The "Photoswipe image caption" option is present on the regular Display page of fields (
/admin/structure/types/manage/library/display), but it's missing for the same field in a View.Please let me know if you need more info @anybody.
Comment #8
ressaAdding "Steps to reproduce".
Comment #9
ressaComment #10
ressaJust setting version to dev, in case a fresh branch needs to be created for an MR at some point :)
Comment #11
ressaGood news, everyone! In #3455963: [5.x] Make Photoswipe work with any ContentEntity entity type @vladdancer shared the cause of the problem, which is in Drupal core #2686145: Formatter third party settings missing from Views UI. After patching Drupal core (Views UI) with the MR from the issue, the PhotoSwipe Caption is available in Views.
Since it's not a PhotoSwipe bug, but we need to heed it, let's turn this issue into a documentation task, adding tips where relevant, like project page, README and documentation pages.
Comment #13
ressaI added a tip in the documentation, and created an MR for the README update, please review.
Administrators: Perhaps you can update the project page, adding something like this? Thanks!
Comment #14
grevil commentedThanks, @ressa!
I added the info to the module page. I'll commit the README change, but we should POSTPONE this issue, until it is fixed in core!
Comment #16
grevil commentedPOSTPONED on #2686145: Formatter third party settings missing from Views UI.
Comment #17
ressaThanks @grevil, just perfect! Adding the tip on the project page, and in the README may save future users a bit of time.
Comment #18
wigglykoala commentedAfter enabling the caption submodule I click on /admin/config I get the following:
Does this relate to the same core problem or should I make a new ticket for this?
Comment #19
grevil commented@wigglykoala, please open a dedicated issue for this.
You can fix this issue through properly installing the photoswipe caption library (recommended to require via composer: Enable use of third party libraries: https://www.drupal.org/docs/develop/using-composer/manage-dependencies#t... and run
composer require npm-asset/photoswipe-dynamic-caption-plugin:^1.But of course this should NOT throw an error.
Comment #20
jglynn commentedIs there anyway to fix the caption issue in views for Drupal 10.6.9? Doesn't seem to be any patch for that issue that would work
Comment #21
jglynn commentedFor those in the same boat, I used https://www.drupal.org/project/glightbox instead
Comment #22
ressa@jglynn The documentation mentioned in comment #13 is the temporary solution, you need to patch Views in Drupal core.
I have updated the workaround mentioned in the Issue Summary under "Proposed resolution" to make this clearer.