This project is not covered by Drupal’s security advisory policy.
Views Multivalue Reference Helper
Fix duplicate rows in Views caused by multi-value entity reference fields.
When using Views with entity reference fields that allow multiple values—such as a checkbox list referencing taxonomy terms—Drupal creates a separate row in the View for each referenced item. This behavior can lead to **duplicate-looking rows**, especially when a content type references multiple taxonomy terms and you're using a **relationship** in Views.
Views Multivalue Reference Helper provides a lightweight workaround by applying a SQL `GROUP BY` on the entity ID (e.g., `nid`) in Views that are affected by this behavior. This helps eliminate duplicated rows and restore the expected output.
Features
- Fixes duplication caused by multi-value entity references in Views.
- Uses `hook_views_query_alter()` to apply `GROUP BY` only on targeted Views and displays.
- Easy to extend or customize.
- Designed for Drupal 10 and 11.
🛠 Use Cases
- Views of content with taxonomy term checkboxes (multi-value).
- Views using relationships to referenced entities.
- Cases where the **DISTINCT** setting in the Views UI has no effect.
Why This Module Exists
This module works around a known Drupal Views limitation, where multi-value entity reference fields cause undesired row duplication.
While Views offers a **DISTINCT** toggle and aggregation options, these often don't resolve the issue or introduce new constraints. This helper module offers a clean and targeted fix.
How It Works
You configure the module to apply `GROUP BY` only to specific Views and displays that need the fix. It does not affect Views globally and does not modify your data or output formatting.
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Project categories: Content display
- Created by sgroundwater on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
