Change record status: 
Project: 
Introduced in branch: 
10.2.x
Introduced in version: 
10.2.0
Description: 

Drupal Core provides an entity reference field type which allows content entity fields to reference other content entities. The field settings require site builders to specify a single entity type to serve as a target for all its items.

Contrib modules such as Dynamic Entity Reference extend this field type to allow for fields that may reference any or all entity types. As such, the field does not have the same entity_type setting. Some code in Drupal core incorrectly assumed this setting was always present and accurate.

A new interface for entity reference field items, \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItemInterface, allows Drupal core to decouple from the field's internals and provides easier integration for contrib and custom code.

Custom entity reference field types should extend the \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItemBase base class.

The core entity reference field implements this new interface, and in Drupal 11 all entity reference fields must implement the interface in their field item class.

Impacts: 
Site builders, administrators, editors
Module developers