You are here

protected function TranslationViewsTargetLanguage::getTargetLangcode in Translation Views 8

Get target language from exposed input.

Return value

string The selected target langcode.

3 calls to TranslationViewsTargetLanguage::getTargetLangcode()
TranslationModerationState::render in src/Plugin/views/field/TranslationModerationState.php
Renders the field.
TranslationOperationsField::getTranslationOperations in src/Plugin/views/field/TranslationOperationsField.php
Operation links manager.
TranslationTargetLanguageField::render in src/Plugin/views/field/TranslationTargetLanguageField.php
Override parent to get langcode from exposed input, instead from ResultRow.

File

src/TranslationViewsTargetLanguage.php, line 36

Class

TranslationViewsTargetLanguage
Trait TranslationViewsTargetLanguage.

Namespace

Drupal\translation_views

Code

protected function getTargetLangcode() {
  $inputs = $this->view
    ->getExposedInput();
  $langcode = isset($inputs[self::$targetExposedKey]) ? $inputs[self::$targetExposedKey] : PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT;
  return $langcode == PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT ? $this->languageManager
    ->getDefaultLanguage()
    ->getId() : $langcode;
}