autocomplete_mixed_matching
131 sites
Security covered
This module provides an autocomplete widget for entity reference fields that combines "STARTS_WITH" and "CONTAINS" matching.
Other than that, the widget behaves exactly like the one from Drupal core.
The result has all the matches that start with the search string, followed by matches that only contain the search string but that don't start with it.
Features
Comparison with core entity autocomplete widget.
Search term Limit CoreSTARTS_WITH Core
CONTAINS New:
Mixed matching "Frog" 3 Frog
Frog eggs 99 frogs
Acrobatic frog
Cyan frog Frog
Frog eggs
99 frogs “Frog” 1 Frog 99 frogs Frog “egg” 3 - Frog eggs Frog eggs
Use case
The main use case are reference fields with a large number of potential targets.
In these cases neither the "CONTAINS" nor the "STARTS_WITH" mode are completely suitable:
- For "STARTS_WITH", there may be no results, if all the items start with a prefix like "The ..." or a number.
- For "CONTAINS", the exact match may never show up, because the list is filled up with less relevant matches.
Post-Installation
Configure any entity form display, use the widget for an entity reference field.