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 %}
Project information
- 29,135 sites report using this module
- Created by MChittenden on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 8.x-1.x-dev updated 8 Nov 2023 at 14:55 UTC
Development version: 7.x-1.x-dev updated 23 Nov 2014 at 05:03 UTC