You are here

public function TranslationCountFilter::query in Translation Views 8

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides NumericFilter::query

File

src/Plugin/views/filter/TranslationCountFilter.php, line 55

Class

TranslationCountFilter
Translation count filter.

Namespace

Drupal\translation_views\Plugin\views\filter

Code

public function query() {

  /** @var \Drupal\views\Plugin\views\query\Sql $query */
  $query = $this->query;
  $op = $this->operator;
  $join_alias = $this
    ->joinLanguages($query);
  $query
    ->addWhereExpression($this->options['group'], "IF(ISNULL({$join_alias}.count_langs), 0, {$join_alias}.count_langs) {$op} :value", [
    ':value' => $this->value['value'],
  ]);
}