function EntityReferenceArgument::titleQuery

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

Overrides NumericArgument::titleQuery

File

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

Class

EntityReferenceArgument
Argument handler to accept an entity reference ID value.

Namespace

Drupal\views\Plugin\views\argument

Code

public function titleQuery() {
    $titles = [];
    $entities = $this->entityTypeManager
        ->getStorage($this->definition['target_entity_type_id'])
        ->loadMultiple($this->value);
    foreach ($entities as $entity) {
        $titles[$entity->id()] = $this->entityRepository
            ->getTranslationFromContext($entity)
            ->label();
    }
    return $titles;
}

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