Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

UidRevision.php

Same filename in this branch
  1. 11.1.x core/modules/node/src/Plugin/views/filter/UidRevision.php

Namespace

Drupal\node\Plugin\views\argument

File

core/modules/node/src/Plugin/views/argument/UidRevision.php

View source
<?php

namespace Drupal\node\Plugin\views\argument;

use Drupal\user\Plugin\views\argument\Uid;
use Drupal\views\Attribute\ViewsArgument;

/**
 * Filter handler, accepts a user ID.
 *
 * Checks for nodes that a user posted or created a revision on.
 */
class UidRevision extends Uid {
    public function query($group_by = FALSE) {
        $this->ensureMyTable();
        $placeholder = $this->placeholder();
        $this->query
            ->addWhereExpression(0, "{$this->tableAlias}.uid = {$placeholder} OR ((SELECT COUNT(DISTINCT vid) FROM {node_revision} nr WHERE nr.revision_uid = {$placeholder} AND nr.nid = {$this->tableAlias}.nid) > 0)", [
            $placeholder => $this->argument,
        ]);
    }

}

Classes

Title Deprecated Summary
UidRevision Filter handler, accepts a user ID.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal