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 %}
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.
More in the Views ecosystem
Most installed first