EntityReferenceFormatterBase should return items with Neutral Access too

Created on 2 October 2024, 7 months ago

In the web/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php file there is an access check:

if ($access->isAllowed()) { // <---
  // Add the referring item, in case the formatter needs it.
  $entity->_referringItem = $items[$delta];
  $entities[$delta] = $entity;
}

I think that we should also check if the access is Neutral:

if ($access->isAllowed() || $access->isNeutral()) { // <---
  // Add the referring item, in case the formatter needs it.
  $entity->_referringItem = $items[$delta];
  $entities[$delta] = $entity;
}
πŸ› Bug report
Status

Active

Version

10.0 ✨

Component

field system

Created by

πŸ‡ΊπŸ‡ΈUnited States rpayanm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024