function EntityReferenceArgument::summaryName

Same name in other branches
  1. 10 core/modules/views/src/Plugin/views/argument/EntityReferenceArgument.php \Drupal\views\Plugin\views\argument\EntityReferenceArgument::summaryName()

Overrides ArgumentPluginBase::summaryName

File

core/modules/views/src/Plugin/views/argument/EntityReferenceArgument.php, line 67

Class

EntityReferenceArgument
Argument handler to accept an entity reference ID value.

Namespace

Drupal\views\Plugin\views\argument

Code

public function summaryName($data) {
    $id = $data->{$this->name_alias};
    $entity = $id ? $this->entityTypeManager
        ->getStorage($this->definition['target_entity_type_id'])
        ->load($id) : NULL;
    if ($entity) {
        return $this->entityRepository
            ->getTranslationFromContext($entity)
            ->label();
    }
    if (($id === NULL || $id === '') && isset($this->definition['empty field name'])) {
        return $this->definition['empty field name'];
    }
    return $id;
}

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