UidRevision.php 788 Bytes
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Definition of Drupal\node\Plugin\views\argument\UidRevision.
6 7
 */

8
namespace Drupal\node\Plugin\views\argument;
9

10
use Drupal\user\Plugin\views\argument\Uid;
11
use Drupal\Component\Annotation\PluginID;
12

13 14 15
/**
 * Filter handler to accept a user id to check for nodes that
 * user posted or created a revision on.
16
 *
17
 * @PluginID("node_uid_revision")
18
 */
dawehner's avatar
dawehner committed
19
class UidRevision extends Uid {
20

21
  public function query($group_by = FALSE) {
22
    $this->ensureMyTable();
23
    $placeholder = $this->placeholder();
24
    $this->query->addWhereExpression(0, "$this->tableAlias.revision_uid = $placeholder OR ((SELECT COUNT(DISTINCT vid) FROM {node_revision} nr WHERE nfr.revision_uid = $placeholder AND nr.nid = $this->tableAlias.nid) > 0)", array($placeholder => $this->argument));
25
  }
26

27
}