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

Breadcrumb

  1. Drupal Core 11.1.x
  2. UserUid.php

function UserUid::query

Same name in this branch
  1. 11.1.x core/modules/comment/src/Plugin/views/filter/UserUid.php \Drupal\comment\Plugin\views\filter\UserUid::query()

Overrides ArgumentPluginBase::query

File

core/modules/comment/src/Plugin/views/argument/UserUid.php, line 82

Class

UserUid
The views user ID argument handler.

Namespace

Drupal\comment\Plugin\views\argument

Code

public function query($group_by = FALSE) {
    $this->ensureMyTable();
    // Use the table definition to correctly add this user ID condition.
    if ($this->table != 'comment_field_data') {
        $subselect = $this->database
            ->select('comment_field_data', 'c');
        $subselect->addField('c', 'cid');
        $subselect->condition('c.uid', $this->argument);
        $entity_id = $this->definition['entity_id'];
        $entity_type = $this->definition['entity_type'];
        $subselect->where("[c].[entity_id] = [{$this->tableAlias}].[{$entity_id}]");
        $subselect->condition('c.entity_type', $entity_type);
        $condition = $this->view->query
            ->getConnection()
            ->condition('OR')
            ->condition("{$this->tableAlias}.uid", $this->argument, '=')
            ->exists($subselect);
        $this->query
            ->addWhere(0, $condition);
    }
}

API Navigation

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