You are here

public function SimilarTermsArgument::query in Similar By Terms 8

Add filter(s).

Overrides NumericArgument::query

File

src/Plugin/views/argument/SimilarTermsArgument.php, line 146

Class

SimilarTermsArgument
Argument handler to accept a node id.

Namespace

Drupal\similarterms\Plugin\views\argument

Code

public function query($group_by = FALSE) {
  $this
    ->ensureMyTable();
  $this->query
    ->addTable('taxonomy_index', NULL, NULL, 'similarterms_taxonomy_index');
  $this->query
    ->addWhere(0, "similarterms_taxonomy_index.tid", $this->tids, 'IN');

  // Exclude the current node(s)
  if (empty($this->options['include_args'])) {
    $this->query
      ->addWhere(0, "node.nid", $this->value, 'NOT IN');
  }
  $this->query
    ->addGroupBy('nid');
}