1 entity.module entity_view_multiple($entity_type, $entities, $view_mode = 'full', $langcode = NULL, $page = NULL)

Generate an array for rendering the given entity.

Parameters

string $entity_type: The type of the entity.

array $entities: An array of entity objects to render.

string $view_mode: A view mode as used by this entity type, e.g. 'full', 'teaser'...

string $langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

bool|NULL $page: (optional) If set will control if the entity is rendered: if TRUE the entity will be rendered without its title, so that it can be embedded in another context. If FALSE the entity will be displayed with its title in a mode suitable for lists. If unset, the page mode will be enabled if the current path is the URI of the entity, as returned by entity_uri().

Return value

The renderable array, keyed by the entity type and by entity ID. If: there is no information on how to view an entity, FALSE is returned.

File

core/modules/entity/entity.module, line 283
Entity API for handling entities like nodes or users.

Code

function entity_view_multiple($entity_type, $entities, $view_mode = 'full', $langcode = NULL, $page = NULL) {
  $info = entity_get_info($entity_type);

  if (in_array('EntityControllerInterface', class_implements($info['controller class']))) {
    return entity_get_controller($entity_type)->view($entities, $view_mode, $langcode, $page);
  }

  return FALSE;
}