Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ranges in Drupal Views

I have a content type that stores two numerical values, effectively the minimum and maximum of a range.

I would like to configure the views module filter so that it will display nodes where the node range is contained within or overlaps a range specified in the view.

like image 971
edwbaker Avatar asked Feb 21 '11 15:02

edwbaker


People also ask

What is contextual range?

Views Contextual Range Filter is a plugin for Views that adds the option to contextually filter not just by a single value, but also by range, such as a price range. Please be aware that contextual filters are different from exposed filters. This module is about contextual filters only.

What are views in Drupal?

The views module allows administrators and site designers to create, manage, and display lists of content. Each list managed by the views module is known as a "view", and the output of a view is known as a "display". Displays are provided in either block or page form, and a single view may have multiple displays.


1 Answers

Views does not allow mixed OR and AND filters. You can configure an existing filter to show all nodes where N > 30 AND N < 50 (between, excluding, 30 and 50).

If you want more complex filters, e.g. filters that have business logic, or filters that create either/or conditions, you can define them yourself, trough hook_views. This is badly documented and requires a lot of googling and reading existing filter code.

like image 164
berkes Avatar answered Sep 19 '22 14:09

berkes