This is a module for the Drupal 8 CMS that adds a custom filter. It will allow you to customize views with the concept of interval (range). An interval is defined by a pair of fields representing the interval bounds.
The type of fields to be used as bounds are intentionally left unrestricted so that it can hopefully work in a wide variety of scenarios. The rule is: if it behaves correctly in the SQL context when applied to operators: <
, <=
, >
, >=
; then it will work as expected.
- Download this repository (as ZIP)
- Install and activate the extension
- Add a new Interval Filter to a view.
- Choose the operator (either contains or not contains)
- Choose the fields to be used to be used respectively as MIN (left bound) and MAX (right bound).
The filter works as follows: It will check if the choosed value belongs (or not, depending on the operator) to the interval bounded by MIN and MAX. The fields MIN and MAX can also be null, this means that the interval is unbounded (either left or right or both).
Example: an item has MIN field = 100 and MAX field null. If value ≥ 100 and operator is contains, it will show that item.