public function UserUid::query in Drupal 10
Same name in this branch
- 10 core/modules/tracker/src/Plugin/views/filter/UserUid.php \Drupal\tracker\Plugin\views\filter\UserUid::query()
- 10 core/modules/tracker/src/Plugin/views/argument/UserUid.php \Drupal\tracker\Plugin\views\argument\UserUid::query()
- 10 core/modules/comment/src/Plugin/views/filter/UserUid.php \Drupal\comment\Plugin\views\filter\UserUid::query()
- 10 core/modules/comment/src/Plugin/views/argument/UserUid.php \Drupal\comment\Plugin\views\argument\UserUid::query()
Same name and namespace in other branches
- 8 core/modules/comment/src/Plugin/views/argument/UserUid.php \Drupal\comment\Plugin\views\argument\UserUid::query()
- 9 core/modules/comment/src/Plugin/views/argument/UserUid.php \Drupal\comment\Plugin\views\argument\UserUid::query()
1 method overrides UserUid::query()
- UserUid::query in core/
modules/ tracker/ src/ Plugin/ views/ argument/ UserUid.php
File
- core/
modules/ comment/ src/ Plugin/ views/ argument/ UserUid.php, line 79
Class
- UserUid
- Argument handler to accept a user id to check for nodes that user posted or commented on.
Namespace
Drupal\comment\Plugin\views\argumentCode
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);
}
}