function Vid::titleQuery

Same name and namespace in other branches
  1. 9 core/modules/node/src/Plugin/views/argument/Vid.php \Drupal\node\Plugin\views\argument\Vid::titleQuery()
  2. 8.9.x core/modules/node/src/Plugin/views/argument/Vid.php \Drupal\node\Plugin\views\argument\Vid::titleQuery()
  3. 11.x core/modules/node/src/Plugin/views/argument/Vid.php \Drupal\node\Plugin\views\argument\Vid::titleQuery()

Override the behavior of title(). Get the title of the revision.

Return value

array Returns all titles, if it's just one title it's an array with one entry.

Overrides NumericArgument::titleQuery

File

core/modules/node/src/Plugin/views/argument/Vid.php, line 57

Class

Vid
Argument handler to accept a node revision id.

Namespace

Drupal\node\Plugin\views\argument

Code

public function titleQuery() {
  $titles = [];
  $results = $this->nodeStorage
    ->getAggregateQuery()
    ->accessCheck(FALSE)
    ->allRevisions()
    ->groupBy('title')
    ->condition('vid', $this->value, 'IN')
    ->execute();
  foreach ($results as $result) {
    $titles[] = $result['title'];
  }
  return $titles;
}

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