Hi all

I have been looking for a solution to my issue here in the forum, but couldn't find any...

The thing is, that I need to create an image gallery, so I have installed the GLightbox module as well as the Mosaic Grid module.  The Mosaic Grid can be used in Views to generate a block of images that are arranged in a grid.

I have successfully created a gallery with fields of the custom type 'gallery-image',  and a layout to display the block created by the view and mosaic grid.  It looks the way I had hoped, however, the gallery-images displayed are not limited to the ones of the node of a specific gallery, but rather the complete collection of gallery-images across all galleries.  So all galleries I create seem to contain the sum of all images in all galleries...

I could configure the filter in the view to include only the gallery-images of a specific node, but then I would need a view for each node/gallery - and that doesn't seem right...

How do I limit the view to provide a block containing only the gallery-images of the node in which the block is displayed?  Or is there an entirely different approach, that would do the trick?

BR
T. Larsen

Accepted answer

Hi T. Larsen.

If I understand this correctly, you have overridden the node/% layout and have placed a Views-provided block to display the images of the node being viewed. Right?

This is how it can be done.

  1. In the View that provides the block, add a Contextual filter: Content: nid
  2. In Block settings > Contextual filter input, click edit and select "From layout" and then Required context: Node

That's it. That block will now use the layout context (node) to provide a contextual filter, only showing the currently visited node.

Comments

Hi T. Larsen.

If I understand this correctly, you have overridden the node/% layout and have placed a Views-provided block to display the images of the node being viewed. Right?

This is how it can be done.

  1. In the View that provides the block, add a Contextual filter: Content: nid
  2. In Block settings > Contextual filter input, click edit and select "From layout" and then Required context: Node

That's it. That block will now use the layout context (node) to provide a contextual filter, only showing the currently visited node.

Hi Argiepiano

That was exactly what I needed!  

Thanks a lot for your feedback - now I can get the last part of my migration from Drupal 7 completed.

T. Larsen