Problem/Motivation
When dynamic caption settings are changed, they have no effect when viewing a page.
Steps to reproduce
- Enable the BigPipe module (enabled by default in the standard profile)
- On
/admin/config/media/photoswipe_dynamic_caption, change "Caption Position" to "Below".
- View a Photoswipe page.
Result: the caption still appears to the right of the image, not below it.
Proposed resolution
When a page is initially loaded, Drupal.behaviors.photoswipeCaption deletes the caption options from drupalSettings, so the options are empty during all subsequent executions of attach(). The caption options should be stored so they can be applied every time attach() is called, not just the first time.
Comments
Comment #3
fj23 commentedPatch attached.
Comment #4
anybodyThanks for pointing this out. I left a comment on the MR.
Comment #5
anybody@grevil: We're running into this in a client project, maybe you could have a look in the next days? See my comment in the MR.
Comment #6
bgreco commentedMakes sense, I assumed the options were being deleted for some other reason, but if they're not hurting anything that's even simpler.
Comment #7
anybodyWell I think, there might have been a reason for that line, which we need to keep, but we should not alter the original value. I'm not deeply into this though.
Comment #11
grevil commentedI honestly have no idea why @segovia94 added this line in the original proof of concept in #3232070: [5.x] PhotoSwipe 5 Branch. Looks like I overlooked that back then.
Thanks for the fix! Works like a charm. :)
Comment #13
grevil commentedComment #14
grevil commentedRelease 5.0.4: https://www.drupal.org/project/photoswipe/releases/5.0.4