You are here

public function TranslationLanguageRenderer::render in Display Suite 8.3

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

Renders entity data.

Parameters

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

Return value

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

Overrides RendererBase::render

File

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

Class

TranslationLanguageRenderer
Renders entity translations in their row language.

Namespace

Drupal\ds\Plugin\views\Entity\Render

Code

public function render(ResultRow $row) {
  $entity_id = $row->_entity
    ->id();
  $langcode = $this
    ->getLangcode($row);
  if (isset($this->build[$entity_id][$langcode])) {
    $build = $this->build[$entity_id][$langcode];
    $this
      ->alterBuild($build, $row);
    return $build;
  }
  return [];
}