TranslationSourceLangcodeEqualsRowLangcodeFilter.php in Translation Views 8
File
src/Plugin/views/filter/TranslationSourceLangcodeEqualsRowLangcodeFilter.php
View source
<?php
namespace Drupal\translation_views\Plugin\views\filter;
use Drupal\views\Plugin\views\filter\BooleanOperator;
class TranslationSourceLangcodeEqualsRowLangcodeFilter extends BooleanOperator {
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,
]);
}
}