Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Group by Field Widget

113 sites Security covered Drupal 9–11 Group ecosystem
View on drupal.org

This module provides a widget for entity reference fields that allows grouping checkbox or radio options into collapsible sections. These groupings can be based on fields within the referenced entities, enabling hierarchical organization of choices.

Overview

Group by Field Widget provides a Drupal entity-reference field widget that organizes selectable entities into collapsible groups.

Drupal’s standard entity-reference widgets display choices as a flat list. That can become difficult to navigate when a field contains many options or when those options naturally belong to categories, locations, departments, or other parent entities. This module uses fields on the referenced entities to build a more meaningful hierarchy.

Why use it?

This module is useful when:

  • An entity-reference field contains too many choices for a flat list.
  • Referenced entities already contain fields that describe how they should be grouped.
  • Editors need contextual information to distinguish similarly named options.
    Options belong to a hierarchy, such as campus → facility → display.
  • You want to improve form usability without changing how entity-reference values are stored.

The widget supports multiple grouping levels and can follow entity-reference relationships. This means grouping does not have to rely only on fields directly attached to the selectable entity.

Use case

Say you need to create a field that lists all the displays you have across all university campuses. So you create a 'Display' content type with a Field called facilities. A 'Facility' content type with field called campus. Lastly, a 'Campus' taxonomy vocabulary. With this module your displays field can be group by a number of nested fields. You can group by Facility or you can group by Campus which is an entity reference in your facility content type.

You typically would the options listed in a flat display like so.

├── Display 1
├── Display 2
├── Display 3

But what if those displays entities had their fields act as a grouping mechanic. A field referencing Displays could group its options by Facility and then by Campus:

Campus A
├── Facility One
│   ├── Display 1
│   └── Display 2
└── Facility Two
    └── Display 3

Each group is rendered as a collapsible details section. Multi-value fields use checkboxes, while single-value fields use radio buttons. Optional radio selections can be cleared by clicking the selected option again.

Other common use cases

Typical applications include grouping:

  • Locations by region or campus
  • Employees by department
  • Products by category
  • Documents by organization
  • Events by venue
  • Equipment by facility
  • Taxonomy terms or content by a related parent entity

The module changes only the form widget. Submitted selections remain standard Drupal entity-reference values, so existing storage, validation, and display behavior continues to work normally.

Installation/Configuration

  • Add an entity reference field to node
  • Head to manage form display, and change the widget to 'Group by field reference widget'
  • If your field is multi-value, it will use checkboxes, otherwise it will use radios.

Related modules

Troubleshooting

Empty "Group by" Selector.

This can happen for one of two reasons. First, only fields with a cardinality of 1 are allowed to be included in the list. Second, Fields using the "Views: Filter by an entity reference view" reference type must first select the bundles needed for field.

Features to come

  • Nested grouping
    • completed with 1.2.0 release
  • Allow for nested fields with a cardinality of 1 to be included even if parent field isn't groupable
  • Allow user to toggle whether the details elements should be open by default.
    • completed with 1.2.0 release
  • Allow users to select which hidden fields they would like to group by.
  • Allow users to sort groupings.
  • Allow for "Views: Filter by an entity reference view" taxonomy
    • completed with 1.1.0 release

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Mar 2025
Latest release
3 weeks ago
Releases (12 mo)
1
Maintenance
Active

Releases

Version Type Core Release date
1.2.6 Stable 9–11 Aug 7, 2026
1.2.5 Stable 9–11 Mar 27, 2025