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()

Set up the query for this argument.

The argument sent may be found at $this->argument.

Overrides ArgumentPluginBase::query

File

lib/Views/comment/Plugin/views/argument/UserUid.php, line 57
Definition of Views\comment\Plugin\views\argument\UserUid.

Class

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

Namespace

Views\comment\Plugin\views\argument

Code

public function query($group_by = FALSE) {
  $this
    ->ensureMyTable();
  $subselect = db_select('comment', 'c');
  $subselect
    ->addField('c', 'cid');
  $subselect
    ->condition('c.uid', $this->argument);
  $subselect
    ->where("c.nid = {$this->tableAlias}.nid");
  $condition = db_or()
    ->condition("{$this->tableAlias}.uid", $this->argument, '=')
    ->exists($subselect);
  $this->query
    ->add_where(0, $condition);
}