function TranslationLanguageRenderer::getLangcode

Same name in other branches
  1. 8.9.x 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()
  3. 11.x core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php \Drupal\views\Entity\Render\TranslationLanguageRenderer::getLangcode()

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 105

Class

TranslationLanguageRenderer
Renders entity translations in their row language.

Namespace

Drupal\views\Entity\Render

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.