function entity_view

Returns the render array for an entity.

Parameters

Drupal\Core\Entity\EntityInterface $entity: The entity to be rendered.

string $view_mode: The view mode that should be used to display the entity.

string $langcode: (optional) For which language the entity should be rendered, defaults to the current content language.

Return value

array A render array for the entity.

5 calls to entity_view()
comment_view in drupal/core/modules/comment/comment.module
Generates an array for rendering a comment.
node_view in drupal/core/modules/node/node.module
Generates an array for rendering the given node.
taxonomy_term_view in drupal/core/modules/taxonomy/taxonomy.module
Generates an array which displays a term detail page.
user_view in drupal/core/modules/user/user.module
Generate an array for rendering the given user.
user_view_multiple in drupal/core/modules/user/user.module
Constructs a drupal_render() style array from an array of loaded users.
1 string reference to 'entity_view'

File

drupal/core/includes/entity.inc, line 543
Entity API for handling entities like nodes or users.

Code

function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL) {
  return entity_render_controller($entity
    ->entityType())
    ->view($entity, $view_mode, $langcode);
}