Change record status: 
Project: 
Introduced in branch: 
11.4.x
Introduced in version: 
11.4.0
Description: 

Both \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::RECURSIVE_RENDER_LIMIT and \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter::$recursiveRenderDepth are deprecated.

A referenced entity can now be successfully re-rendered more than 20 times. Example use cases:

  • Running batch search indexing on rendered content with the same media referenced by multiple indexed nodes.
  • Rendering a node multiple times in a batch to be sent out as email newsletters.

Rendering recursion is now protected by tracking whether an entity is currently being rendered. This is done in Drupal\Core\Entity\EntityViewBuilder, where #pre_render and #post_render callbacks are added to the entity render array in getBuildDefaults(). These callbacks set and unset a tracking array entry indexed by the imploded cache keys of the render array for the entity.

Impacts: 
Site builders, administrators, editors
Module developers