Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Primary Entity Reference

Security covered Under active development 83 sites

This module adds a field type that allows you to reference multiple entities while designating one as primary. It ensures exactly one entity is always marked as the primary reference.

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 ⚙

If you haven't already, install DDEV.

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 s-ayers/ddev-drupal-contrib-mkdocs
ddev add-on get s-ayers/ddev-drupal-paratest
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

Consider sponsoring DDEV development.

Ask your assistant about Primary Entity Reference

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
12
Tracked since
May 2025
Latest release
2 months ago
Releases (12 mo)
11 ▲ from 1
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.0.0-beta8 Pre-release 11 Aug 4, 2026
1.0.0-beta7 Pre-release 11 Feb 15, 2026
1.0.0-beta6 Pre-release 11 Feb 2, 2026
1.0.0-beta5 Pre-release 11 Jan 30, 2026
1.0.0-beta4 Pre-release 11 Jan 29, 2026
1.0.0-beta3 Pre-release 11 Jan 27, 2026
1.0.0-beta2 Pre-release 11 Jan 18, 2026
1.0.0-beta1 Pre-release 11 Dec 22, 2025
1.0.0-alpha3 Pre-release 11 Dec 12, 2025
1.0.0-alpha2 Pre-release 11 Oct 23, 2025