Score:5

How does the Geolocation content of a page filter is a Views block?

cn flag

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

cn flag
Does no one have a solution ?
Score:0
mx flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.