You are here

public function TranslationTargetLanguageFilter::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 FilterPluginBase::query

File

src/Plugin/views/filter/TranslationTargetLanguageFilter.php, line 297

Class

TranslationTargetLanguageFilter
Provides filtering by translation target language.

Namespace

Drupal\translation_views\Plugin\views\filter

Code

public function query() {
  if ($this->options['remove']) {
    $this->query
      ->addWhere($this->options['group'], $this->view->storage
      ->get('base_table') . '.langcode', '***TRANSLATION_VIEWS_TARGET_LANG***', '<>');
  }
  if (isset($this->options['limit']) && $this->options['limit']) {
    $table_alias = $this
      ->ensureMyTable();
    $this->query
      ->addWhereExpression($this->options['group'], "FIND_IN_SET(:langcode_limit, {$table_alias}.langs) >= '0' AND :langcode_limit != ''", [
      ':langcode_limit' => '***TRANSLATION_VIEWS_TARGET_LIMIT_LANG***',
    ]);
  }
}