Normally, when a Views field has been assigned both an exposed filter and a contextual filter, then both filters get applied to the View's results set -- always. This is not configurable behaviour. It's hard-coded.
As a consequence, contradictory search clauses easily occur, causing a counter-intuitive user experience with some White Screens of Disillusionment. Since the contextual filter sets the "bounds" for the page, any filtering by the visitor through the exposed filter on that page can only narrow down the results set, not broaden it. In other words the exposed filter appears not to be working properly.
This small module allows you to have a contextual filter argument apply only when there is no corresponding regular (exposed) filter value present.
This is most common on initial page load. After that the contextual filters will silently retreat and let the exposed filter values as selected by the visitor do their thing without interfering.
This means that you can take advantage of friendly URLs using contextual arguments instead of ugly and verbose query parameters. Put the URLs anywhere on your site, in emails and in newsletters to take visitors to tailored Views pages. Having arrived there, visitors may then further filter these pages to their heart's content using the View's regular filters you exposed.
And they won't experience any odd behaviour.
Hands on: the problem and the solution in 60 seconds
You can do this on your own test site or you can click here and press "Launch sandbox" to simplytest the latest version of Views Filter Harmonizer live online.
Let's go through a simple scenario. We start by creating two pieces of content of type Article, which allows tags to be added to each article. For the first, type the tag name "blue", for the other enter the tag "red".
We'll demonstrate Views' bad default behaviour first, using a View that is already on your system.
- Enable the Views UI submodule.
- At admin/structure/views, enable the canned View named Taxonomy term and edit it.
- Under Filter Criteria click Add and tick the box Content: Has taxonomy terms (with depth). This is the counterpart to the contextual filter that already exists on this View. Click Apply
- On the next panel, tick the Tags vocabulary, Dropdown and Apply.
- Then tick Expose this filter to visitors and press Is one of. Apply and Save the View.
- Visit /taxonomy/term/1, where we assume that 1 is the id of the "blue" term (article tag)
- You'll see your "blue" article as expected.
- Switch the colour drop-down to "red" and press Apply.
- Duh? No output? That's right. That's default Views behaviour for you. You are filtering on all content that is both "blue" (via the contextual filter) and "red" (via the exposed filter). Confusing and not what we want is it?
So now, for some much needed relief, enable Views Filter Harmonizer.
- Visit its configuration page, admin/config/content/filter_harmonizer, click the first two check boxes on the page and press Save configuration.
- Go back to /taxonomy/term/1, viewing the "blue" article as before.
- Switch the colour drop-down to "red" and voila: we see "red" as expected.
Refer to the README for notes on the use of this module with Views displayed in blocks.