0

What I am trying achieve here(d7) is a bit cleaner URLs which is looking odd due to 8-12 contextual filters. Except 1 or 2 filters others will be /all most of the times.

Suppose I have 5 contextual filters. When only the first one has value, the URL becomes example.com/24/all/all/all/all. Is there a way we can avoid "/all/all/all/all" ?

I have also tried using query parameters through PHP CODE.

If I choose 'Provide default value' -> 'PHP code' and use

$query= $_GET['clr'];
return $query;

Is there a way we can tell views to consider "query=all" for other queries automatically if that part is omitted in URL?

For ex: If URL is

example.com?clr=1234

the view should assume it to be

example.com?q1=all&q2=all&q3=all&q4=all&clr=1234

2 Answers 2

0

I don't know if it clashes with your configuration, but usually you use the option Display all results for the specified field under When the filter value is NOT available.


There is also the option under When the filter value IS available or a default is provided > Specify validation criteria:

Action to take if filter value does not validate

where you can choose to Display all results for the specified field. Maybe you can combine it with some Validation conditions to achieve what you want.

2
  • Even if it is "Display all results for the specified field", the parameter is needed in URL. Otherwise it goes to "Page Not Found". Aug 26, 2018 at 14:06
  • Not necessarily, I guess it depends on your other options.
    – prkos
    Aug 26, 2018 at 16:08
0

I didn't find solution for contextual filter. But the behavior I wanted is achieve is possible by using

Filter Criteria (Exposed) instead of Contextual filter.

Here instead of using Exposed Filter form, I am providing Links which is working fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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