public function EntityRow::pre_render

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

Overrides RowPluginBase::pre_render

File

drupal/core/modules/system/lib/Drupal/system/Plugin/views/row/EntityRow.php, line 116
Definition of Drupal\system\Plugin\views\row\EntityRow.

Class

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

Namespace

Drupal\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']);
  }
}