public function UserUid::query

Same name in this branch

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 FilterPluginBase::query

File

drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/filter/UserUid.php, line 23
Definition of Drupal\comment\Plugin\views\filter\UserUid.

Class

UserUid
Filter handler to accept a user id to check for nodes that user posted or commented on.

Namespace

Drupal\comment\Plugin\views\filter

Code

public function query() {
  $this
    ->ensureMyTable();
  $subselect = db_select('comment', 'c');
  $subselect
    ->addField('c', 'cid');
  $subselect
    ->condition('c.uid', $this->value, $this->operator);
  $subselect
    ->where("c.nid = {$this->tableAlias}.nid");
  $condition = db_or()
    ->condition("{$this->tableAlias}.uid", $this->value, $this->operator)
    ->exists($subselect);
  $this->query
    ->addWhere($this->options['group'], $condition);
}