About
Contextual Filter Range Validator adds a Views contextual filter validator that can evaluate a numeric filter value based on user-supplied constraints.
Use Cases
Hide or show a view attachment based on a page URL parameter.
The example steps below can be used to display a view attachment on the first page only:
- Create a page view with an attachment.
- Add a contextual filter to the attachment (Attachment -> Advanced -> Contextual Filters -> Add)
- From the “Add contextual filters” popup:
- Select “This attachment (override)” from the For menu.
- Select “Global” from the Category menu.
- Enable the checkbox for the “Null” filter.
- Click Apply (this display).
- Under When the filter value is NOT available, select Provide a default value and set the following options:
- Type: Query parameter
- Query parameter: page
- Fallback value: 0
- Under When the filter value IS available or a default is provided, select Specify validation criteria and set the following options:
- Validator: Range
- Minimum value: (blank)
- Maximum value: 0
- Action to take if filter value does not validate: Hide view
- Click Apply (this display).
- Click Save for the full view.
Once this view is saved, the view page should only show the attachment on the first page because this module’s validator is set to hide the attachment whenever the page URL parameter is not empty (or zero).
Requirements
- Views (core)
Installation
- Download and uncompress the module manually or via Composer.
- Enable the module from
/admin/modules.
Sponsorship
Development of Contextual Filter Range Validator is supported by Cascade Public Media for KCTS9.org and Crosscut.com.
Supporting organizations:
Project information
Seeking new maintainer
The current maintainers are looking for new people to take ownership.No further development
No longer developed by its maintainers.36 sites report using this module
- Created by wells on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
