public function TranslationSourceLangcodeEqualsRowLangcodeFilter::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 BooleanOperator::query
File
- src/
Plugin/ views/ filter/ TranslationSourceLangcodeEqualsRowLangcodeFilter.php, line 19
Class
- TranslationSourceLangcodeEqualsRowLangcodeFilter
- Filter rows by equity of two langcodes.
Namespace
Drupal\translation_views\Plugin\views\filterCode
public function query() {
$table_alias = $this
->ensureMyTable();
$base_table = $this->view->storage
->get('base_table');
$this->query
->addWhereExpression($this->options['group'], "IF(({$table_alias}.content_translation_source {$this->operator} {$base_table}.langcode) OR ({$table_alias}.default_langcode {$this->operator} 1), 1, 0) = :value", [
':value' => $this->value,
]);
}