You are here

public function TranslationLanguageRenderer::getLangcode in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php \Drupal\ds\Plugin\views\Entity\Render\TranslationLanguageRenderer::getLangcode()
  2. 8.3 src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php \Drupal\ds\Plugin\views\Entity\Render\TranslationLanguageRenderer::getLangcode()

Returns the language code associated to the given row.

Parameters

\Drupal\views\ResultRow $row: The result row.

Return value

string A language code.

Overrides DefaultLanguageRenderer::getLangcode

1 call to TranslationLanguageRenderer::getLangcode()
TranslationLanguageRenderer::render in src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php
Renders entity data.

File

src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php, line 61

Class

TranslationLanguageRenderer
Renders entities in the current language.

Namespace

Drupal\ds\Plugin\views\Entity\Render

Code

public function getLangcode(ResultRow $row) {
  return isset($row->{$this->langcodeAlias}) ? $row->{$this->langcodeAlias} : $this->languageManager
    ->getDefaultLanguage()
    ->getId();
}