You are here

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

Same name in this branch
  1. 8.3 lib/Views/node/Plugin/views/filter/UidRevision.php \Views\node\Plugin\views\filter\UidRevision::query()
  2. 8.3 lib/Views/node/Plugin/views/argument/UidRevision.php \Views\node\Plugin\views\argument\UidRevision::query()

Set up the query for this argument.

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

Overrides Numeric::query

File

lib/Views/node/Plugin/views/argument/UidRevision.php, line 24
Definition of Views\node\Plugin\views\argument\UidRevision.

Class

UidRevision
Filter handler to accept a user id to check for nodes that user posted or created a revision on.

Namespace

Views\node\Plugin\views\argument

Code

public function query($group_by = FALSE) {
  $this
    ->ensureMyTable();
  $placeholder = $this
    ->placeholder();
  $this->query
    ->add_where_expression(0, "{$this->tableAlias}.uid = {$placeholder} OR ((SELECT COUNT(*) FROM {node_revision} nr WHERE nr.uid = {$placeholder} AND nr.nid = {$this->tableAlias}.nid) > 0)", array(
    $placeholder => $this->argument,
  ));
}