Views global filters

Views Global Filter is a contributed Drupal 6 and 7 module that applies one visitor filter choice to several views. It has no Drupal 11 release.

Learn DrupalDrupal glossary

With Views Global Filter, a visitor picks a value, such as a country, once, and the module passes it invisibly as a contextual filter to every view the site builder chose. It is not part of Drupal core Views. In Drupal 11 you use core parts instead, and you set them on each view: exposed filters, a remembered selection and contextual filters.

The Global group in the Views UI is something else. It lists core handlers such as the Combine fields filter, which combines several fields and searches them together.

What the module does

The project page describes the idea as "picked once, operates site-wide". The 7.x version supports both fields and Views and offers several selection widgets. The selected value is stored in the session, a cookie or the database. The project page shows it last updated on 4 December 2015 and says there are no supported stable releases.

The project has an 8.x-1.0-alpha0 release, and its release notes say it holds only an info file. Its release list shows no 9.x, 10.x or 11.x version. A tutorial that tells you to install it on Drupal 11 is wrong: there is no release to install.

What to use in Drupal 11

Combine these core parts as the job needs.

  • Remember the selection. An exposed filter has the option Remember the last selection. The Views source describes remembered exposed input as stored in the session.
  • Move the form. For a display with a path, Exposed form in block puts the filter form in a block that you place yourself.
  • Read a value from the address. Each exposed filter has an identifier that appears in the URL after the question mark. A contextual filter can take its default value from a query parameter, which is a named value in that part of the address.

Example

A site has two views, one for events and one for partners. Both content types have a Region list field with keys such as emea. Expose a region filter on the events page with the identifier region. On the partners view, add a contextual filter on the region field and choose Provide default value, then Query parameter, with the parameter name region. A link such as /partners?region=emea now filters the partners view, because it reads the region from the address.

Common mistakes

  • Expecting one setting for all views. Remembering a selection and exposing a filter are set on each view.
  • Forgetting anonymous visitors. The remember option stores nothing for roles you did not select, and by default only the authenticated role is selected.

For marketing and content teams

If you want a visitor's choice, such as a region, language of interest or product line, to carry across pages, write that requirement down with the pages involved. Your developer can then pick between a remembered selection, a link that carries the value in the address, or a custom solution.

Sources

Questions about Views global filters

No. The release list of the project shows 6.x and 7.x versions plus an 8.x-1.0-alpha0 release whose notes say it holds only an info file. It shows no 9.x, 10.x or 11.x release, and it marks every release as unsupported. The project page says there are no supported stable releases.

Three parts: exposed filters, an option to remember an exposed selection, and contextual filters that can read a value from the address. Each is set on a single view, so you combine them to link several views.

Turn on Remember the last selection on the exposed filter. The Views source describes remembered exposed input as kept in the session. You can limit it to chosen user roles; with no roles selected, the data is never stored.

Related terms

All Drupal terms from A to Z