You are here

public function Fid::titleQuery in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/src/Plugin/views/argument/Fid.php \Drupal\file\Plugin\views\argument\Fid::titleQuery()
  2. 9 core/modules/file/src/Plugin/views/argument/Fid.php \Drupal\file\Plugin\views\argument\Fid::titleQuery()

Override the behavior of titleQuery(). Get the filenames.

Overrides NumericArgument::titleQuery

File

core/modules/file/src/Plugin/views/argument/Fid.php, line 58

Class

Fid
Argument handler to accept multiple file ids.

Namespace

Drupal\file\Plugin\views\argument

Code

public function titleQuery() {
  $storage = $this->entityTypeManager
    ->getStorage('file');
  $fids = $storage
    ->getQuery()
    ->accessCheck(FALSE)
    ->condition('fid', $this->value, 'IN')
    ->execute();
  $files = $storage
    ->loadMultiple($fids);
  $titles = [];
  foreach ($files as $file) {
    $titles[] = $file
      ->getFilename();
  }
  return $titles;
}