Drupal is a registered trademark of Dries Buytaert

Primary Entity Reference is a field type that extends the standard Entity Reference field with the ability to mark one referenced entity as the primary.

This is useful for content types where you want to reference multiple entities but always need one of them to be considered the “main” or “default” — for example:

  • Setting an Address as primary.
  • Highlighting the primary author among multiple contributors.
  • Marking the featured image out of a gallery.
  • Defining a main contact from a list of people.

Features 🔧

  • Provides a custom field type that stores multiple entity references, with one marked as primary.
  • Ensures exactly one referenced entity is always primary.
  • If only one value exists, it is automatically treated as primary.
  • Includes a widget for selecting the primary item inline.
  • Includes a formatter that displays only the primary entity.
  • Fully compatible with Drupal’s Field API.

Integration

Inline Entity Form

Projects that use Primary Entity Reference

CRM

Development ⚙

git clone [email protected]:project/primary_entity_reference.git
cd primary_entity_reference
ddev config --project-type=drupal --docroot=web --php-version=8.4 --corepack-enable --project-name=primary-entity-reference
ddev add-on get ddev/ddev-drupal-contrib
ddev add-on get ddev/ddev-selenium-standalone-chrome
ddev start
ddev poser
ddev symlink-project
ddev drush site:install -y
ddev drush pm:install primary_entity_reference -y
ddev drush config:export -y
ddev drush user:login

Activity

Total releases
11
First release
May 2025
Latest release
2 weeks ago
Release cadence
27 days
Stability
0% stable

Release Timeline

Releases

Version Type Release date
1.0.0-beta7 Pre-release Feb 15, 2026
1.0.0-beta6 Pre-release Feb 2, 2026
1.0.0-beta5 Pre-release Jan 30, 2026
1.0.0-beta4 Pre-release Jan 29, 2026
1.0.0-beta3 Pre-release Jan 27, 2026
1.0.0-beta2 Pre-release Jan 18, 2026
1.0.0-beta1 Pre-release Dec 22, 2025
1.0.0-alpha3 Pre-release Dec 12, 2025
1.0.0-alpha2 Pre-release Oct 24, 2025
1.0.0-alpha1 Pre-release Oct 23, 2025
1.0.x-dev Dev May 17, 2025