Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: MCP Sentinel 2.29.0 — Minor update available for module mcp_sentinel (2.29.0). Release: Audit Chain 1.10.9 — Minor update available for module audit_chain (1.10.9). Release: Menu Autopilot 1.4.7 — Minor update available for module menu_autopilot (1.4.7). Release: FileGate 1.11.3 — Minor update available for module file_gate (1.11.3). Release: Download Tracker 1.0.7 — Minor update available for module download_tracker (1.0.7). Release: Directory2Block Slideshow 1.0.8 — Minor update available for module directory2block_slideshow (1.0.8). Release: Mautic Audiences 1.1.5 — Minor update available for module mautic_audiences (1.1.5). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (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

Views Contextual Filter Validator: Regular Expression adds a Views contextual filter validator that can evaluate an argument based on user-supplied regular expression pattern.

Requirements

This module does not require any additional modules outside of Drupal core.

Installation

Install as you would normally install a contributed Drupal module. See: https://drupal.org/documentation/install/modules-themes/modules-8 for further information.

Configuration

The module has no menu or modifiable settings. There is no configuration.

Use

Add a Regular express (regex) validator to a View's contextual filter to use this module. E.g. --

  1. Create a new View with a page display.
  2. Add a contextual filter (Advanced -> Contextual Filters -> Add).
  3. From the "Add contextual filters" popup:
    • Select "Global" from the Category menu.
    • Enable the checkbox for the "Null" filter.
    • Click Add and configure contextual filters.
  4. Under When the filter value IS available or a default is provided, select Specify validation criteria and set the following options:
    • Validator: Regular expression (regex)
    • Regular expression: /^\d{4}$/
    • Action to take if filter value does not validate: Show Page not found
  5. Click Apply.
  6. Click Save for the full view.

This example ensures that the first contextual filter is exactly four digits. If the filter contains any non-digits or is not exactly four characters, the View page will give a "Page not found" error.

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