public function TranslationLanguageRenderer::preRender in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php \Drupal\views\Entity\Render\TranslationLanguageRenderer::preRender()
- 9 core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php \Drupal\views\Entity\Render\TranslationLanguageRenderer::preRender()
File
- core/
modules/ views/ src/ Entity/ Render/ TranslationLanguageRenderer.php, line 81
Class
- TranslationLanguageRenderer
- Renders entity translations in their row language.
Namespace
Drupal\views\Entity\RenderCode
public function preRender(array $result) {
$view_builder = \Drupal::entityTypeManager()
->getViewBuilder($this->entityType
->id());
/** @var \Drupal\views\ResultRow $row */
foreach ($result as $row) {
$entity = $row->_entity;
$entity->view = $this->view;
$langcode = $this
->getLangcode($row);
$this->build[$entity
->id()][$langcode] = $view_builder
->view($entity, $this->view->rowPlugin->options['view_mode'], $this
->getLangcode($row));
}
}