entity_reference_override
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!!