You are here

public function Entity::pre_render in Views (for Drupal 7) 8.3

Overrides Drupal\views\Plugin\views\row\RowPluginBase::pre_render().

Overrides RowPluginBase::pre_render

File

lib/Views/system/Plugin/views/row/Entity.php, line 117
Definition of Views\system\Plugin\views\row\Entity.

Class

Entity
Generic entity row plugin to provide a common base for all entity types.

Namespace

Views\system\Plugin\views\row

Code

public function pre_render($result) {
  parent::pre_render($result);
  if ($result) {

    // Get all entities which will be used to render in rows.
    $entities = array();
    foreach ($result as $row) {
      $entity = $row->_entity;
      $entity->view = $this->view;
      $entities[$entity
        ->id()] = $entity;
    }

    // Prepare the render arrays for all rows.
    $this->build = entity_view_multiple($entities, $this->options['view_mode']);
  }
}