Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module allows you to add a custom text field alongside your entity reference fields. This lets you override the referenced entity's title or text fields, add CSS classes, or change its display mode on a case-by-case basis. It's useful for customizing how referenced content appears when displayed in lists or aggregated pages.

An entity reference field paired with an accompanying text field. This custom text field on the referencing entity can be used to:

  • override the linked entity's title
  • override any text field or text area (including WYSIWYG) on the referenced entity
  • add an extra class to its rendered output, or
  • override the default display mode for the field on an entity-by-entity basis.

Use cases

  • You're building "related article" lists or aggregate pages that use entity references to pull in other articles, but you need to tweak the appearance of individual entities for contextual relevance or emphasis.
  • Give per-project job roles to people credited on a project.
  • Provide a contextually-relevant short bio for an author referenced from a piece of article content.

If you need it, you're feeling happy right now.

Post-Installation (Usage)

Go to the Manage fields tab of any fieldable entity, for example Administration » Structure » Content types » Article » Manage fields for the article content type. Press Add field, and using the Add a new field dropdown, scrolling to under Reference, select "Entity reference w/custom text", provide a label for your entity referencing field, and then press Save and continue.')

On the resulting page, select what type of item to reference and allowed number of values as you would for any entity reference field, and Save field settings.

Community Documentation

We have documentation started at Entity Reference Override documentation, edits and new pages there welcome!

Based on the approach of extending a field type in Drupal 8 by Lullabot's Matt Robison.

Similar Modules

See Media Library Media Modify for a better and more robust approach to referenced media.

If you do not need the secondary field to be an optional override of a value from the referenced entity, that is if you find yourself making a field that will never be used on the original content just to "override" it with this module, you are better off with the Custom Field module.

Supporting this Module

You can support Agaric's overall contributions to Drupal and a bit beyond by supporting Drutopia at opencollective.com/drutopia. Thanks!!

Activity

Total releases
2
First release
Jan 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Release date
2.0.0-beta4 Pre-release Apr 11, 2025
2.0.0-beta3 Pre-release Jan 21, 2025