function TranslationLanguageRenderer::preRenderByRelationship
Same name in other branches
- 11.x core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php \Drupal\views\Entity\Render\TranslationLanguageRenderer::preRenderByRelationship()
Overrides EntityTranslationRendererBase::preRenderByRelationship
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 preRenderByRelationship(array $result, string $relationship) : void {
$view_builder = \Drupal::entityTypeManager()->getViewBuilder($this->entityType
->id());
/** @var \Drupal\views\ResultRow $row */
foreach ($result as $row) {
if ($entity = $this->getEntity($row, $relationship)) {
$entity->view = $this->view;
$langcode = $this->getLangcodeByRelationship($row, $relationship);
$this->build[$entity->id()][$langcode] = $view_builder->view($entity, $this->view->rowPlugin->options['view_mode'], $langcode);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.