function EntityLabel::preRender

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/field/EntityLabel.php \Drupal\views\Plugin\views\field\EntityLabel::preRender()
  2. 8.9.x core/modules/views/src/Plugin/views/field/EntityLabel.php \Drupal\views\Plugin\views\field\EntityLabel::preRender()
  3. 11.x core/modules/views/src/Plugin/views/field/EntityLabel.php \Drupal\views\Plugin\views\field\EntityLabel::preRender()

Overrides FieldPluginBase::preRender

File

core/modules/views/src/Plugin/views/field/EntityLabel.php, line 128

Class

EntityLabel
Field handler to display entity label optionally linked to entity page.

Namespace

Drupal\views\Plugin\views\field

Code

public function preRender(&$values) {
    parent::preRender($values);
    $entity_ids_per_type = [];
    foreach ($values as $value) {
        if ($type = $this->getValue($value, 'type')) {
            $entity_ids_per_type[$type][] = $this->getValue($value);
        }
    }
    foreach ($entity_ids_per_type as $type => $ids) {
        $this->loadedReferencers[$type] = $this->entityTypeManager
            ->getStorage($type)
            ->loadMultiple($ids);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.