I am looking for a way (in D8) to create a colorbox gallery for a node field with multiple images but I am facing the following problems:

  • colorbox only works as an image field formatter (no media field formatter).
  • I would prefer media field since its nice to have entity browser to reuse some of the images.
  • Trying to create an image field that collects image using entity browser did not work for me. I was getting the error "The entity must be of type file" and none of the solutions seemed to work either. I even created a new entity browser but it did not succeed.
  • Media gallery and other related modules are not yet ported to Drupal 8

Is there any alternative?

1 Answer 1


I have finally managed to find a workaround which involves creating a view that displays the media field images based on contextual information from the node. The field formatter can be changed to a view using views_field_formatter module

Here is in a little more detail

lets assume the content type that we want to have media gallery is named "gallery" and it contains a media field "field_media" and assume colorbox and views_field_formatter modules are installed and enabled

  1. prepare a view that displays nodes of content type "gallery" (a block view is enough)
  2. add relationship that exposes the field_media and call it "media"
  3. add contextual filter "Content ID" based on "media" relationship
  4. add appropriate image field to display (based on the "media" relationship) and use colorbox formatter (since this field is an image colorbox will be available)
  5. go to the gallery content type display settings and configure the media field to use the view prepared above passing as first parameter the node id
  • Nice workaround. I've tried it and it works for me. However I can not run colorbox as a presentation and only get the colorbox effect for every media separately. Could you? If so, how did you do? May 8, 2017 at 15:44
  • 1
    I have setup Gallery (image grouping) as per page gallery. I thought the per field in page would work as well but it does not ... it might be a bug
    – GiorgosK
    May 8, 2017 at 17:16
  • I know this was posted a while back, so am adding an update as it may be due to newer version of D8 (8.7beta), but I didn't need to do point 3 to get this to work, once I'd added the 'relationship' from point 2, I could then find the image field and add colorbox formatter. Wouldn't have found this on my own, so thank you @GiorgosK !
    – iain-g
    Apr 4, 2019 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.