You are here

public function UserUid::query in Views (for Drupal 7) 8.3

Same name in this branch
  1. 8.3 lib/Views/comment/Plugin/views/filter/UserUid.php \Views\comment\Plugin\views\filter\UserUid::query()
  2. 8.3 lib/Views/comment/Plugin/views/argument/UserUid.php \Views\comment\Plugin\views\argument\UserUid::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 FilterPluginBase::query

File

lib/Views/comment/Plugin/views/filter/UserUid.php, line 26
Definition of Views\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

Views\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
    ->add_where($this->options['group'], $condition);
}