You are here

public function TranslationSourceLangcodeEqualsRowLangcodeField::query in Translation Views 8

Called to add the field to a query.

Overrides FieldPluginBase::query

File

src/Plugin/views/field/TranslationSourceLangcodeEqualsRowLangcodeField.php, line 38

Class

TranslationSourceLangcodeEqualsRowLangcodeField
Provides a field that adds translation status.

Namespace

Drupal\translation_views\Plugin\views\field

Code

public function query() {
  $table_alias = $this
    ->ensureMyTable();
  $base_table = $this->view->storage
    ->get('base_table');
  $this->query
    ->addField(NULL, "IF(({$table_alias}.content_translation_source = {$base_table}.langcode) OR ({$table_alias}.default_langcode = 1), 1, 0)", 'source_lang_eq_row');
}