Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Views Conditional

Security covered Under active development 24,827 sites

Part of the Views ecosystem · 286 projects

This module allows you to add conditional logic to Drupal Views fields. You can display different content based on whether a field's value meets certain criteria, like being equal to, greater than, or empty. This enables customized output within your views.

Views Conditional is a simple module that allows you to define conditionals (if xxx then yyy)
with fields in views.

Drupal 9/10 Conditions include:

  • Equal To
  • Not Equal To
  • Greater Than
  • Greater Than or Equals
  • Less Than
  • Less Than or Equals
  • Empty
  • Not Empty
  • Contains
  • Does Not Contain
  • Length Equal To
  • Length Not Equal To
  • Length Greater Than
  • Length Less Than

Views conditional allows you to output text based on the result of the condition.

---

How to use Views Conditional in your Views:
1. Create a view. Add some fields under "FIELDS".
2. Click on "ADD" next to fields. Scroll down to "Views: Views Conditional", probably found near the bottom of the list.
3. Add and configure fields...
4. Choose a field to run a condition against, and provide values accordingly.
5. Save, views conditional handles the logic and returns as specified.

Documentation

Read the WebWash Tutorial for Views Conditional

Note:
In many cases since Drupal 8, this module may be obsolete, because using Twig for Views rewriting we can now use conditional logic.

{% if {{ field_show_other_flag }} %}
  {{ field_other_thing }}
{% else %}
  {{ field_main_thing }}
{% endif %}
Drupal 9–11

Ask your assistant about Views Conditional

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
5
Tracked since
Nov 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
8.x-1.10 Stable 9–11 Jun 1, 2024
8.x-1.9 Stable 9–10 Nov 8, 2023
8.x-1.8 Stable 9–10 Nov 7, 2023
8.x-1.7 Stable 9–10 Nov 7, 2023
8.x-1.6 Stable 9–10 Nov 7, 2023