Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityReferenceArgument.php

function 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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal