Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

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:

  1. Create a page view with an attachment.
  2. Add a contextual filter to the attachment (Attachment -> Advanced -> Contextual Filters -> Add)
  3. 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).
  4. 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
  5. 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
  6. Click Apply (this display).
  7. 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

  1. Download and uncompress the module manually or via Composer.
  2. 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.

Depends on

Dependencies of the latest stable release

  • views Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Aug 2024
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
2.0.2 Stable 9–11 Sep 8, 2024
2.0.1 Stable Aug 14, 2024