dynamic_reference_selection
Dynamic filtering for Entity Reference fields based on parent field values, with AJAX support. Lightweight and focused: ideal for projects that need dynamic reference filtering without the complexity of full rules engines.
Description
Dynamic Reference Selection allows you to create dependent Entity Reference fields using Views as the data source. The options in a child reference field are dynamically filtered based on the selection of a parent field, enabling use cases such as Genre > Song or Country > City selection patterns.
This module is a clean, modern fork of the Business Rules Entity Reference Selection plugin, offering the same dependent filtering functionality without the overhead of the full Business Rules module—which is no longer maintained. It also provides a more robust and flexible alternative to Dependent Field and Dependant Reference Method, which are not actively maintained and do not support Drupal 11.
How It Works
- Configure a parent and child Entity Reference field (e.g., Genre and Song).
- Create a View for the child entity (e.g., songs) with a contextual filter (e.g., genre ID or UUID).
- In the child field settings, select "Dynamic Reference Selection" as the reference method.
- Choose the View and map the parent field as the argument.
- AJAX is used to refresh the child options when the parent selection changes.
Both parent and child fields must use the “Select list” widget in the form display for the dynamic filtering to work properly.
Credits
Inspired by and initially based on the Business Rules module’s reference plugin. Extended and maintained to support modern Drupal projects.