Problem/Motivation
With the Drupal core autocomplete (Tags style) widget, a referenced entity shows its ID. Autocomplete Deluxe hides it, which is nicer to read, but the ID is sometimes the only thing that tells two entities apart — two taxonomy terms with the same word, or the same word with and without accents on a multilingual site — and it is also useful when the referenced entity has to be filtered by ID somewhere else.
Steps to reproduce
- Add two entities with the same label to the vocabulary or content type being referenced.
- Reference them with a field using the Autocomplete Deluxe widget.
- The two tags read the same, and the suggestion list shows the same word twice.
Proposed resolution
Add a widget setting, Show the entity ID, which is off by default so nothing changes for the sites that are happy with the clean label. When it is on, the tag and the suggestion list keep the ID that the stored value already carries.

Remaining tasks
- ✅ File an issue
- ✅ Addition/Change/Update/Fix
- ✅ Testing to ensure no regression
- ➖ Automated unit testing coverage
- ➖ Automated functional testing coverage
- ➖ UX/UI designer responsibilities
- ➖ Readability
- ➖ Accessibility
- ➖ Performance
- ➖ Security
- ➖ Developer Documentation
- ➖ User Guide Documentation
- ➖ Reviewed by human
- ➖ Code review by maintainers
- ➖ Full testing and approval
- ➖ Credit contributors
- ➖ Review with the product owner
- ➖ Release notes snippet
- ❌ Release
User interface changes
- A new Show the entity ID checkbox in the widget settings, off by default.
API changes
- N/A
Data model changes
- The widget carries one more setting, show_entity_id, which defaults to FALSE.
Release notes snippet
- The Autocomplete Deluxe widget can now show the entity ID beside the label, which tells two entities with the same name apart.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3181219-tags-with-and-without-entity-id.png | 75.09 KB | rajab natshah |
| #3 | autocomplete-deluxe-id.PNG | 45.91 KB | emilie.viau |
Issue fork autocomplete_deluxe-3181219
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3181219-show-the-entity-id
changes, plain diff MR !33
- 3181219-allow-to-show
changes, plain diff MR !13
Comments
Comment #2
shenron_segamag commentedComment #3
emilie.viau commentedI suggest to report as a bug rather than a feature request. Reason : when you work in multilingual websites, like in French, words in Taxonomy may have different forms with and without accents. For example, the word "léipoa" and leipoa can be both with or without accent. In such case, Drupal ask us to specify the ID, which is possible with the native autocomplete, but not with Autocomplete Deluxe. In fact, we have the possibility to specify the ID temporarily, but as soon as we save the page and open it again, the ID has disappeared and Drupal display an error.
Comment #4
rajab natshahComment #8
kevinvb commentedAdded extra commit so not only the entered items are displaying the entity ID but also the autocomplete results display their ID.
We encountered this issue because we had a project containing multiple nodes with the same title making it almost impossible to know which item corresponds with the desired node.
Comment #9
kevinvb commentedComment #11
rajab natshahThank you, Vanessa for reporting, Emilie for the multilingual case, and Ales and Kevin for the work on the earlier merge request.
Kept it as an option rather than always on, since most sites picked this widget for the clean label. The new merge request adds a Show the entity ID checkbox to the widget settings, off by default.
Tested on Drupal 11.4 with two fields on one form, one with the setting on and one off: the tags read Test (1) and Alpha (beta) (6) with it on and stay clean with it off, the suggestion list follows the same rule, and saving stores the right term IDs and creates no new terms.
To review, test, then merge.
Comment #13
rajab natshahThis is already in. The work was committed to 2.1.x on 29 August as "Add a widget setting to show the entity ID in the tag", and it is currently the tip of the branch.
Everything is there: the
show_entity_idsetting with its checkbox, the line in the widget summary, the handling in the suggestions and in the tags, and a feature file covering it. The issue had simply been left at needs review, so I am marking it fixed to match what the branch actually holds.One loose end worth tidying separately. There is still an open merge request against 2.0.x for this issue, from before the work moved to 2.1.x. It is superseded now and can be closed whenever you are happy to.
Prepared with AI assistance (Claude), reviewed and driven by the maintainer.