EntityTranslationRendererBase.php in Drupal 8
File
core/modules/views/src/Entity/Render/EntityTranslationRendererBase.php
View source
<?php
namespace Drupal\views\Entity\Render;
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Drupal\views\ResultRow;
abstract class EntityTranslationRendererBase extends RendererBase {
public abstract function getLangcode(ResultRow $row);
public function query(QueryPluginBase $query, $relationship = NULL) {
}
public function preRender(array $result) {
$view_builder = \Drupal::entityTypeManager()
->getViewBuilder($this->entityType
->id());
foreach ($result as $row) {
$entity = $row->_entity;
$entity->view = $this->view;
$this->build[$entity
->id()] = $view_builder
->view($entity, $this->view->rowPlugin->options['view_mode'], $this
->getLangcode($row));
}
}
public function render(ResultRow $row) {
$entity_id = $row->_entity
->id();
return $this->build[$entity_id];
}
}