In my views generated image gallery I use Views Infinite Scroll with a "load more" button:
At first 9 images are shown on my page, the load more button loads the next 9 image and so on.

All images are shown in a colorbox gallery popup with the following problem: They are grouped - only 9 images are shown in one colorbox gallery. You have to click on one of the images 10 to 18 to open a new colorbox gallery that shows only 9 images (image 10 to 18). Gallery breaks into parts of 9 images.

The reason is the value for data-colorbox-gallery. I changes with every "load more" click. In order to show all images on the page in one colorbox gallery the value for data-colorbox-gallery has to be identically for all images.

How to solve / repair this in Drupal 8 version of Colorbox module?
Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drupalfan2 created an issue. See original summary.

Anonymous’s picture

This all has to do with the Unique per-request gallery token in the Colorbox settings - Advanced Settings section.

By default, its enabled to help keep galleries unique. The simplest way to fix this, is to turn it to Off.

The other option is to keep it on and use my new patch.

I created a patch to expose the token and allow it to be re-used, particularly for AJAX requests on a page.

I also added a bit of code to work directly with views_infinite_scroll to add the token to what it posts when loading new pages.

Neslee Canil Pinto’s picture

Status: Needs review » Closed (cannot reproduce)
Michelle’s picture

@rsmylski thanks so much for this! This has been driving me crazy and turning that setting off worked perfectly for me. I have no idea why Neslee set this as can't reproduce since it's so easy to reproduce but, given the sheer number of issues across multiple projects he has abruptly closed with no explanation, I suspect they didn't even try it.

Neslee Canil Pinto’s picture

Version: 8.x-1.4 » 8.x-1.x-dev

@Michelle I had a test of this issue, and I didn't reproduce this issue in my local, maybe I had missed something, do you suggest to re-open this?

Michelle’s picture

@Neslee Canil Pinto - It would be nice to get rsmylski's patch in if we could. At the very least, adding this to the documentation would be helpful. I'm not sure if I'd consider it a "bug", technically, but it's definitely a UX WTF because you end up with a seamless list of images that appear to be arbitrarily grouped due to the way they load. I was very happy to find a fix for this issue and I'm sure others will be as well.

Note: I just went with the option of turning off the unique galleries so I haven't tested the patch.