Description of the need

I use node and user references all the time. It would be great if we could add these to core.

Proposed solution (Updated 2022)

Move the Entity Reference contrib module into core. It has been refactored to remove any external dependencies. Entity Reference is the most obvious candidate based on the following advantages:

1) It has the highest install count. 2) It has the most flexible API and number of extending modules. 3) It is a proven solution and includes an upgrade path for D7 Entity Reference users.

Previous solution (Prior to 2022)

This was the original solution proposed in 2015. After the stalling of the new "Reference" project and the subsequent porting and updating of Entity Reference, this approach has failed to gain traction.

1) We should create a new module reference that is a rewrite of the Drupal 7 entityreference module, in language that is simpler and easier to understand. It will more closely resemble node_reference and user_reference from the Drupal 7 references module. There is now a new Reference module in contrib 2) Once the module is ready, we should move this module into core. When is the module "ready"? When it has support for node references, and all blockers in the contrib queue have been resolved.

Core Blockers for adding the reference module into core - [x] Add view function: https://github.com/backdrop/backdrop-issues/issues/1739 - [x] Define label and status entity keys: https://github.com/backdrop/backdrop-issues/issues/3103 - [x] Add options array for files: https://github.com/backdrop/backdrop-issues/issues/2299

We also have a single issue in the module queue documenting all the issues there that need to be resolved for core inclusion: META: Blockers for getting into core

Alternatives that have been considered

  • Put references into core: we decided not to put individual reference modules into core because in Drupal people seem to prefer having a single field type for everything. We would also prefer the consistency since we believe it will make a better user experience.

Additional information

We have a follow-up issue for removing the term-reference field, and replacing it with a reference field, but it's likely that we'll get support for terms in first, long before we remove the previous term reference field: https://github.com/backdrop/backdrop-issues/issues/51. It's been recommended that we mark that field type as deprecated for 1 major cycle of backdrop core, and remove it in the next.

The core issue below is only needed for file entity support. If reference doesn't support file references at the time it goes into core, we don't need to handle this core issue yet, so it's not a blocker:

* Handle file stream wrappers : https://github.com/backdrop/backdrop-issues/issues/2300

Advocate: @herbdool

GitHub Issue #: 
1301