public function EntityRenderController::buildContent

Implements \Drupal\Core\Entity\EntityRenderControllerInterface::buildContent().

Overrides EntityRenderControllerInterface::buildContent

5 methods override EntityRenderController::buildContent()

File

drupal/core/lib/Drupal/Core/Entity/EntityRenderController.php, line 32
Contains \Drupal\Core\Entity\EntityRenderController.

Class

EntityRenderController
Base class for entity view controllers.

Namespace

Drupal\Core\Entity

Code

public function buildContent(array $entities, array $displays, $view_mode, $langcode = NULL) {
  field_attach_prepare_view($this->entityType, $entities, $displays, $langcode);
  module_invoke_all('entity_prepare_view', $this->entityType, $entities, $displays, $view_mode);
  foreach ($entities as $entity) {

    // Remove previously built content, if exists.
    $entity->content = array(
      '#view_mode' => $view_mode,
    );
    $entity->content += field_attach_view($entity, $displays[$entity
      ->bundle()], $langcode);
  }
}