Closed (won't fix)
Project:
PhotoSwipe - Responsive JavaScript Modal Image Gallery
Version:
3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Mar 2023 at 17:41 UTC
Updated:
2 Mar 2023 at 06:47 UTC
Jump to comment: Most recent
Comments
Comment #2
anybodyThe reason is, that if attaching the library via
photoswipe/photoswipe.initthe photoswipe container (from templates/photoswipe-container.html.twig) is missing on the page.That's a problem I have no solution for yet ...
The container is added in
The question is, if this is worth solving or use the global option instead, until Photoswipe v5 is implemented, which doesn't need this container anymore.
Comment #4
anybodyAs the current error message is not very clear, let's at least add a better error message for now.
Comment #6
anybodyLet's merge this improved error message for now, until we have a solution or decide to not fix this and use v5.
Workaround for now: Enable the global option at /admin/config/media/photoswipe
Comment #7
thomas.frobieter@anybody There should be a hook to load the libraries, as you told me :P
Comment #8
anybodySo I think as long as the JS library needs this boilerplate code, but it's not added in the library by JS (which we intentionally don't do), there's no solution here.
For Photoswipe v4 aka module version 3.x the only solution for such custom cases is to call
\Drupal::service('photoswipe.assets_manager')->attach($attachments);in a hook or add the template code manually on the page before attaching
photoswipe/photoswipe.initlibrary.We won't fix this here for 3.x anymore.
In #3345294: Image Paragraph lightbox zoom misses to load photoswipe library I'll try to call
\Drupal::service('photoswipe.assets_manager')->attach($attachments);via hook.