You are here

public function UidRevision::query in Drupal 9

Same name in this branch
  1. 9 core/modules/node/src/Plugin/views/filter/UidRevision.php \Drupal\node\Plugin\views\filter\UidRevision::query()
  2. 9 core/modules/node/src/Plugin/views/argument/UidRevision.php \Drupal\node\Plugin\views\argument\UidRevision::query()
Same name and namespace in other branches
  1. 8 core/modules/node/src/Plugin/views/filter/UidRevision.php \Drupal\node\Plugin\views\filter\UidRevision::query()

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides InOperator::query

File

core/modules/node/src/Plugin/views/filter/UidRevision.php, line 16

Class

UidRevision
Filter handler to check for revisions a certain user has created.

Namespace

Drupal\node\Plugin\views\filter

Code

public function query($group_by = FALSE) {
  $this
    ->ensureMyTable();
  $placeholder = $this
    ->placeholder() . '[]';
  $args = array_values($this->value);
  $this->query
    ->addWhereExpression($this->options['group'], "{$this->tableAlias}.uid IN({$placeholder}) OR\n      ((SELECT COUNT(DISTINCT vid) FROM {node_revision} nr WHERE nr.revision_uid IN ({$placeholder}) AND nr.nid = {$this->tableAlias}.nid) > 0)", [
    $placeholder => $args,
  ], $args);
}