3 namespace Drupal\comment\Plugin\views\filter;
5 use Drupal\views\Plugin\views\filter\FilterPluginBase;
8 * Filter handler to accept a user id to check for nodes that user posted or
11 * @ingroup views_filter_handlers
13 * @ViewsFilter("comment_user_uid")
15 class UserUid extends FilterPluginBase {
17 public function query() {
18 $this->ensureMyTable();
20 $subselect = db_select('comment_field_data', 'c');
21 $subselect->addField('c', 'cid');
22 $subselect->condition('c.uid', $this->value, $this->operator);
24 $entity_id = $this->definition['entity_id'];
25 $entity_type = $this->definition['entity_type'];
26 $subselect->where("c.entity_id = $this->tableAlias.$entity_id");
27 $subselect->condition('c.entity_type', $entity_type);
30 ->condition("$this->tableAlias.uid", $this->value, $this->operator)
33 $this->query->addWhere($this->options['group'], $condition);