5

I have a website with Drupal 9 and the Geolocation module :

https://www.drupal.org/project/geolocation

I created a content type with a Geolocation field that contains coordinates.

My website uses the Olivero theme. I want to create a Views page with the summary my nodes and create a Views block with my nodes on a map.

The block must be on the same page, but it must be in the "Hero (full width)" region of the Olivero theme.

I have added a filter exposed in "Filtering criteria" of the Geolocation module to my page to filter the nodes in proximity.

I want this filter to be applied to the page, but also to the block. How to filter the page and the block ?

Here is the configuration of my Views :

The page.

enter image description here

The exposed filter "Proximity" for the Geolocation field, with its identifier.

enter image description here

The block.

enter image description here

I added a context filter, but the block is not filtered, if I filter the page with Proximity in "Filter criteria".

enter image description here enter image description here enter image description here

1
  • Does no one have a solution ?
    – zoulou66
    Dec 30, 2021 at 18:50

1 Answer 1

0

To be able to inherit the exposed filter you need to use the "Attachment" Views Display type, not the "Block" Views Display type.

But you won't be able to control the theme Region positioning, you can only choose "Above" or "Below" the results. It may still look the way you want, or you may use CSS to adjust the layout.

Add the Attachment type to your Views, and copy all the settings to it that you have on Block and set the Attachment to Inherit exposed filters: to Yes.

You will find that option in the "central" column in Attachment options:

Attachment Views Display options

Then you can delete the "Block" Views Display.

This will apply the same exposed filter to the list of nodes and the map attachment.

You can also try the Exposed form in block: Yes option, add the block with the filter to a Region of your theme. This will control the placement of the Exposed filter, not the block with the map.


Alternatively also check out the Views Global Filter module and its Issues, maybe there's a version for newer Drupal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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