I have a view of items that have a due date, and I want to be able to expose a boolean filter "Is overdue by more than 30 days"

I can create a filter on this due date as a relative date filter "<= today -30 days"; however this filter is always active on the view.

The best I've been able to come up with is to add a new boolean field on my content type "date_filter" that is always null, and in the view create a new exposed filter "is not null" (i.e, when active, will always be false).
Then add this filter to a new OR filter group with the above relative date filter. This works, as when the filter is "off" it returns true and overrides the relative date filter. When on, only the rows that fit the date filter are returned.

However, is there a way to do this without adding dummy fields? Ideally a module I can use to do this. I'd prefer not to have to write a hook just for this filter.

1 Answer 1


There is a module for that; you can use Views Dependent Filters which allows the presence of exposed filters on a view to being controlled by values in another exposed filter. Dependent filters are hidden when not relevant, and their values are not considered when the exposed form is submitted.

  • Turns out I already have this module installed. However, looking over it, I can't see how to make it work to do what I want above. It appears to be using one field to drive exposing dependent filters based on the value of the first, e.g., product type vs product specific filters. The case above is that I only have one filter/field I want to switch on and off, but not expose directly
    – BM-
    Commented Apr 29, 2020 at 3:24

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.