Views

Show result list of a view with exposed filters only when filters set

CSÉCSY László's picture

There is a (Views2) view listing any type of elements and with at least one exposed filter. The task is to show the empty text instead of the list if the filter is not set. One part of the solution can be found at drupal.org's forum, but is not perfect. It works fine while every part of the exposed filters are textfields - but there are views with optional filters shown as dropdowns/selects with the first, "empty" element being <All>. This value is being sent to PHP as All, so the array checked in the above code will not be empty, so the list will appear when one of the exposed filters was shown as dropdown/select, and was optional. Here is a solution which works fine even in such cases.

Syndicate content