Problem/Motivation
One major piece of functionality from the D7 Entity Reference module was left out entirely in #1801304: Add Entity reference field: the ability to render exposed views filters as a select list or autocomplete of available entities.
Proposed resolution
Generalize the taxonomy module's TaxonomyIndexTid
plugin to be available for all entity reference fields and migrate the existing taxonomy filters to be based on the new generic filter plugin.
How to use
- Add on an entity type / bundle an entity reference field, ex field_test_reference.
- Create a view displaying this entity type.
- Add a filter on the view for field_test_reference.
- Configure the entity selection mode and the widget display mode.
- Configure the filter behavior (ex: required, multiple, etc.)
- Finally use the filter field for filtering the results based on the selected entity from the autocomplete or select list.
Remaining tasks
- ☑ support for content entity reference
- ☑ support for configuration entity reference
- ☑ support for content with and without bundles
- ☑ taxonomy filter rebased on generic entity reference
- ☑ settings forms to configure the filter
- ☑ display widget in select or autocomplete
- ☑ filter values based on reference view
- ☑ filter values based on bundles
- ☑ maximum filter values in select list for performance concerns
- ☑ sort for filter values when in bundle selection handler mode
- ☑ argument support for when view selection handler is used
- ☑ views configuration schema update
- ☐ existing configuration migration
☐ fix select option (#208, #215)- ☑ tests
Post tasks
- ☐ conversion of the "authored by" filter to use the entity reference filter
- ☐ extract selection handler form logic in separate plugins that will specialize for rendering and validating the filter selection config form
- ☐ caching of the value form?
- ☐ documentation updates
User interface
![]() | ![]() |
Known issues
- CANNOT REPRODUCE ATM
sometimes when switching between widget it gets stuck on the previous selected one - FIXED
when switching between the widget types the previous value is left in the exposed form and it's incompatible with the other widget type - FIXED
triggering ajax requests on the extra options form right after adding the filter brings you back to the add handler formfixed
API changes
None.