RadioactivityReferenceFormatterBase.php in Radioactivity 4.0.x
File
src/Plugin/Field/FieldFormatter/RadioactivityReferenceFormatterBase.php
View source
<?php
namespace Drupal\radioactivity\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase;
abstract class RadioactivityReferenceFormatterBase extends EntityReferenceFormatterBase {
protected function getEntitiesToView(EntityReferenceFieldItemListInterface $items, $langcode) {
$entities = [];
foreach ($items as $delta => $item) {
if (empty($item->_loaded)) {
continue;
}
$entity = $item->entity;
$entity->_referringItem = $items[$delta];
$entities[$delta] = $entity;
}
return $entities;
}
}