You are here

public function TranslationLanguageRenderer::getLangcode in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php \Drupal\views\Entity\Render\TranslationLanguageRenderer::getLangcode()
  2. 10 core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php \Drupal\views\Entity\Render\TranslationLanguageRenderer::getLangcode()

Returns the language code associated with the given row.

Parameters

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

Return value

string A language code.

Overrides EntityTranslationRendererBase::getLangcode

2 calls to TranslationLanguageRenderer::getLangcode()
TranslationLanguageRenderer::preRender in core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php
Runs before each entity is rendered.
TranslationLanguageRenderer::render in core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php
Renders entity data.

File

core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php, line 106

Class

TranslationLanguageRenderer
Renders entity translations in their row language.

Namespace

Drupal\views\Entity\Render

Code

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