Not sure how to categorize this since it's not a "bug" per se, but lacking from documentation. Posting in case it's helpful to someone else.

This is how I got inline image galleries to work.

  • Install colorbox_load
  • In theme *.libraries.yml, add the following (not sure if this is actually necessary - the idea is to force colorbox output on every page so we can use it):
    dependencies:
    - core/drupal.ajax
    - colorbox/colorbox
  • Add images wrapped in a link, as it was done in Drupal 7. Use class="colorbox cboxElement".
  • To combine multiple images into galleries, use data-colorbox-gallery="". rel="" doesn't work anymore, even though colorbox documentation says it does and the data-* property isn't documented anywhere.

Example working html:

	<a href="/sites/default/files/images/IMG_1531.jpg" class="colorbox cboxElement" data-colorbox-gallery="gallery-beforeafter">
		<img src="/sites/default/files/images/IMG_1531-thumb.jpg">
	</a>

Comments

jasonschweb created an issue. See original summary.

jasonschweb’s picture

Issue summary: View changes
jasonschweb’s picture

Issue summary: View changes
frjo’s picture

Category: Bug report » Support request
Status: Active » Fixed

Colorbox for Drupal 8 is a image field formatter and nothing more, or less. The extra features like colorbox_load and colorbox_inline can be found in contrib. If you have questions about them please use their issues queues.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Carlos Miranda Levy’s picture

Regardless, I can confirm rel="" no longer works and data-colorbox-gallery="" does the trick.

This is not mention in the README.txt of colorbox and neither colorbox_inline or colorbox_load have README.txt files so this information is nowhere to be found other than in this post.

At least, here's where I found it.

4kant’s picture

Thanks jasonschweb.

You showed me the next piece of the drupal 8 puzzle ;-)

bcobin’s picture

Drupal 9:

Adding the [colorbox cboxElement] class to the image and entering same in NG Lightbox is the only way I found to get it to work.

This isn't documented anywhere, so thanks to @jasonschweb for starting me down the right path.