function TranslationLanguageRenderer::renderByRelationship

Same name in other branches
  1. 10 core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php \Drupal\views\Entity\Render\TranslationLanguageRenderer::renderByRelationship()

Overrides EntityTranslationRendererBase::renderByRelationship

File

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

Class

TranslationLanguageRenderer
Renders entity translations in their row language.

Namespace

Drupal\views\Entity\Render

Code

public function renderByRelationship(ResultRow $row, string $relationship) : array {
    if ($entity = $this->getEntity($row, $relationship)) {
        $entity_id = $entity->id();
        return $this->build[$entity_id][$this->getLangcodeByRelationship($row, $relationship)];
    }
    return [];
}

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