Entity Reference Labels

Categories

Component ID

2927871

Component name

Entity Reference Labels

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

52

Component created

Component changed

Component body

Tired of the non-descriptive entity reference autocomplete labels? This module enhances the core labels with the entity's machine name, which is especially useful if a referenced entity has the same name as another one being referenced.

Before (with core):

Before

After (with this module in use):
After

REQUIREMENTS

You must have the entity_reference core module installed.

INSTALLATION

EXAMPLE USAGE

  • Create an entity reference field that references block configuration, however this could be another entity type.
  • On the field's edit page, select "Default (Descriptive)" as the reference method.
  • Make sure the field uses an autocomplete widget on the form display settings.
  • On your edit page, you can search via typeahead like a normal autocomplete field, but the format will be "Entity Label [machine_name]" instead of just "Entity Label".

PURPOSE

Why not just write something like this yourself? Extending the entity reference selection plugin is actually quite tricky because it uses the Deriver subsystem in Drupal 8, thus it requires more than a simple plugin.

CONTACT

Current maintainer:
David Lohmeyer (vilepickle) - https://www.drupal.org/u/vilepickle