0

The examples in contextual arguments simply call for specifying them with slashes without specifying the name of the filter, but if you wish to apply the second or third filter in the contextual link, what syntax should be used? eg if there are contextual filters, on field_1, field_2 and field_3 and you want to ignore field_1 and field_2 in the URL, how do you write the URL for field_3 only?

Even if you want to apply only the first filter, but specify it explicitly in the URL, what is the syntax for it?

PS. When contextual fields for different fields are applied are they combined with OR or AND? are they

2

Contextual filters always use AND operator between them. Unless you use a special module to change it Views Contextual Filters OR.

But there are conditions under which a Contextual filter will show all the results as if it hasn't been applied. This means that it could be seen as if the OR operator is applied.

Contextual filters have two major options in their configuration:

`When the filter value is NOT available` 

and

`When the filter value IS available or a default is provided`   

Under the former options there is always the Exceptions setting, where the default value is all (you can change it if you think it would be better for UX).

But this means that you can use that expression in the URL as a way to temporarily cancel that Contextual filter, so you can test the others if you have more than one.

field_1_value/all/all

or in your case to ignore the first and the second one:

all/all/field_3_value

To apply the first one only you can use:

field_1_value/all/all

but you could also use

field_1_value

if you have configured the last two Filters to use
Display all results for the specified field or
Provide default value.

There is also the setting Action to take if filter value does not validate under Specify validation criteria where you can choose the option Display all results for the specified field. So you can also use this in combination with other settings, if it makes sense in your specific case.

Setting up a Contextual filter isn't a trivial thing, there are different "paths" that can come out out of a single filter, and you'll get a different set of results.

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.