function EntityTranslationRendererBase::renderByRelationship

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

Renders entity data.

Parameters

\Drupal\views\ResultRow $row: A single row of the query result.

string $relationship: The relationship to be used.

Return value

array A renderable array for the entity data contained in the result row.

1 call to EntityTranslationRendererBase::renderByRelationship()
EntityTranslationRendererBase::render in core/modules/views/src/Entity/Render/EntityTranslationRendererBase.php
Renders entity data.
1 method overrides EntityTranslationRendererBase::renderByRelationship()
TranslationLanguageRenderer::renderByRelationship in core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php
Renders entity data.

File

core/modules/views/src/Entity/Render/EntityTranslationRendererBase.php, line 91

Class

EntityTranslationRendererBase
Defines a base class for entity translation renderers.

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];
    }
    return [];
}

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