Entity Reference Roundup

← Back to Blog

  • By

    unknown

  • 10 Jul, 2017

bethany-legg-3376-edit.jpeg

Drupal's Entity reference fields are the magic sauce that allows site builders and developers to relate different types of content. Because the fields allows builders and administrators to reference different types of content (entities), it facilitates the building of complex data models and site architectures.

Like anything in Drupal, the community takes the core tools and builds additional functionality on top. Here is a slew of modules that extend or complement the Drupal 8 core reference field so you can do even more!

Entity Reference Revisions

This module is from the team that brought you the Paragraphs module. Adds an Entity Reference field type that has revision support. It's based on the core Entity Reference module but allows you to reference a specific revision of an entity.

Use case:

An entity is actually part of a parent entity (with an embedded entity form). When the parent entity is updated, the referenced entity is also updated, thus the previous revision of the parent entity should still be pointing to the previous version of the entity in order to fully support revision diff and rollback.

Entity Reference Override

An entity reference field paired with a text field. You can use this module to

  • Override the title if you are linking to the referenced entity.
  • Add an extra CSS class to the referenced entity.
  • Override the default display mode for the field on an entity-by-entity basis.

Use case:

Aggregate lists of referenced entities like related articles, but you want to override the name or appearance of individual items.

Entity references with text

Allows you to provide custom text along with one or more entity references.

Use case:

  • Add a referenced author, the word "and ”, and then another referenced author.
  • On another node, Add a referenced author, the words "with support from ”, and then another referenced author.
  • On another node, Add a referenced author, a comma ", ”, another referenced author, the word "and ”, and then another referenced author.

Entity Reference Display

This module adds a field type that allows you to select the display mode for entity reference fields. This allows an editor to select from different display modes such as Teaser, Full, or any you add.

It also includes a Selected display mode field formatter which renders the referenced entities with the selected display mode.

Use case:

Allowing the administrator to change the display of related articles from a grid display mode to a list display mode.

Entity Reference Views Select

This module allows you to change your Entity reference fields to be displayed as a select list, or checkboxes/radio buttons in administrative forms. It does this by allowing you to use Views as the reference method, where you can format the results giving the administrator a much better experience.

Use case:

Showing an icon or thumbnail in a selectable list when referencing a list, or a referenced image.

Entity Reference Tab / Accordion Formatter

This cool little module works on both Entity Reference and Entity Reference Revisions fields and provides a field formatter for displaying the referenced entity in jQuery Tabs or jQuery Accordion.

Use case:

Returning multivalue Paragraphs items in tabs or accordion format.

Views Entity Reference Filter

Provides a new admin friendly Views filter for configuring entity reference fields. It allows users to select the labels of the entities they want to filter on rather than manually entering the IDs.

Use case:

Providing a better admin experience.

Better Entity Reference Formatter

This module extends Drupal's default field formatter for entity reference fields in order to make it more flexible by introducing a new field formatter plugin. Along side the view mode option, you can also define the number of entities to return, or a specific entity, like the first, last, or offset them.

Use case:

Showing the first related product referenced from another product.

Entity Reference Validators

The plural in its name suggests more is coming, but currently this module adds a single validator for Entity Reference fields, the Circular reference validator. This prevents you from using the entity reference field to reference itself.

Use case:

Preventing an entity reference field on node 1 from linking to node 1.

Entity Reference Integrity

This interesting sounding module lists other entities that reference your entity.

It also includes a sub-module Entity Reference Integrity Enforce which will attempt to protect entities that are referenced by other entities, and not allowing its deletion.

Use case:

Protect the integrity of the site by protecting referenced content.

Entity Reference Quantity

This module extends the default entity reference field that includes a "Quantity" value in the field definition so you don't have to build a separate entity just to store two distinct fields.

It also includes autocomplete and dropdown field widgets that allow you to select which entity and add the quantity value.

Use case:

I'll use the example from this great blog on the module: A real world example might be a deck builder for a trading card game like Magic: The Gathering or the DragonBall Z TCG. We want to reference a card from a deck entity and put in the quantity at the same time.

Entity Reference Formatter

This module creates a generic field formatter for referenced entities which allows you to select the formatter based on the referenced entity in the display settings form.

Use case:

When referencing custom entities that don't have view-modes of their own, you would not need to write your own custom formatters

Permissions by field

This module extends the Entity Reference field that adds permissions along with the referenced entity. By adding this field, you can manage access to the entities referenced by this field and select permission level (none, view, update, delete).

Use case:

A lighter version of Organic Groups, or the Group modules.

Views Reference Field

In Drupal 8, Views are now entities! Drupal core's Entity Reference field is able to reference Views, however you can't actually reference the Views displays. This module extends core's entity reference module to add the display ID so that a View can be rendered in a field formatter.

Use case:

Adding a Views reference field to a Paragraphs bundle so you can have a view in and around other paragraph bundles. We implemented this technique in the Bootstrap Paragraphs module.

Dynamic Entity Reference

So cool! This awesome module adds the functionality to let you reference more than one entity type. It create a single field in which you can reference Users, Blocks, Nodes, Contact Forms, Taxonomy Terms, etc!

Use case:

Creating a "related” field, and allowing your administrators to select anything they want.

Entity Reference Drag & Drop

This module creates a Drag & Drop widget for the standard Entity reference fields. It provides you with a list of available entities on the left, and you can select them by dragging and dropping them to the list on the right.

Use case:

Providing a better admin experience.

Inline Entity Form

This awesome module adds two widgets for your the reference fields on your admin form, one that allows simple selection of referenced entities, and one that allows you to add an entity, which then will be referenced.

This is super helpful for your content managers as they can create all their entities on one screen, rather than adding an author, or a t-shirt size, then having to create a blog post or product.  They can start on the primary piece of content, and add the secondary entities on the same page.

Use case:

Providing a better admin experience.

Phew! Thanks for making it to the end! Do you have a favorite Entity Reference module that we missed? Let us know on Twitter at @xenophiles and @thejimbirch

Happy Drupaling!

Photo Credit: Bethany Legg on Unsplash

Need expert Drupal development on your next project? Tell us about it!

Recent posts

Brewhouse Legends Craft Beer Christmas
04 Mar, 2020
What you should do about Google's de-indexing bug.
11 Apr, 2019
What’s the Difference between Web Design and Web Development?
29 Sep, 2018