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:

v4

Missing in PhotoSwipe, version 5.0.5

v5

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:

FUTURE: Remove the temporary workaround when it gets fixed in Drupal core #2686145: Formatter third party settings missing from Views UI:

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork photoswipe-3523410

Command icon 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

jatinkumar1989 created an issue. See original summary.

jatinkumar1989’s picture

StatusFileSize
new930 bytes

field is not render , need to remove filter

anybody’s picture

Assigned: jatinkumar1989 » Unassigned
Issue summary: View changes
Status: Needs work » Postponed (maintainer needs more info)

Please provide a proper description by filling the issue template:

jaroslav červený’s picture

When you create a view with fields - image fields, there is no option to select a caption.

This option is supported in version 4.

jaroslav červený’s picture

StatusFileSize
new44.3 KB
jaroslav červený’s picture

StatusFileSize
new158.78 KB
ressa’s picture

Title: photo filed - caption » Caption missing in Views, present in regular field Display
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Needs work

I 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.

ressa’s picture

Issue summary: View changes

Adding "Steps to reproduce".

ressa’s picture

Issue summary: View changes
ressa’s picture

Version: 5.0.5 » 5.x-dev
Status: Needs work » Active

Just setting version to dev, in case a fresh branch needs to be created for an MR at some point :)

ressa’s picture

Title: Caption missing in Views, present in regular field Display » Missing Photoswipe Views caption: Drupal core's third party settings formatter missing from Views UI
Component: Code » Documentation
Assigned: Unassigned » ressa
Category: Bug report » Task
Issue summary: View changes
Status: Active » Needs work
Parent issue: » #2686145: Formatter third party settings missing from Views UI
Related issues: +#3455963: [5.x] Make Photoswipe work with any ContentEntity entity type

Good 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.

ressa’s picture

Assigned: ressa » Unassigned
Issue summary: View changes
Status: Needs work » Needs review

I 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!

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.

grevil’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, @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!

  • grevil committed ce535a29 on 5.x authored by ressa
    [#3523410] chore: Missing Photoswipe Views caption: Drupal core's third...
grevil’s picture

Status: Reviewed & tested by the community » Postponed
ressa’s picture

Thanks @grevil, just perfect! Adding the tip on the project page, and in the README may save future users a bit of time.

wigglykoala’s picture

After enabling the caption submodule I click on /admin/config I get the following:

The website encountered an unexpected error. Try again later.

ValueError: Path cannot be empty in file_get_contents() (line 76 of modules/contrib/photoswipe/modules/photoswipe_dynamic_caption/photoswipe_dynamic_caption.install).
photoswipe_dynamic_caption_requirements()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 109)
Drupal\system\SystemManager->listRequirements() (Line: 93)
Drupal\system\SystemManager->checkRequirements() (Line: 122)
Drupal\system\Controller\SystemController->overview()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 23)

Does this relate to the same core problem or should I make a new ticket for this?

grevil’s picture

@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.

jglynn’s picture

Is 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

jglynn’s picture

For those in the same boat, I used https://www.drupal.org/project/glightbox instead

ressa’s picture

Issue summary: View changes

@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.