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.

15 calls to entity_view()
aggregator_page_source in drupal/core/modules/aggregator/aggregator.pages.inc
Page callback: Displays all the items captured from the particular feed.
BlockStorageUnitTest::renderTests in drupal/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php
Tests the rendering of blocks.
comment_view in drupal/core/modules/comment/comment.module
Generates an array for rendering a comment.
contact_mail in drupal/core/modules/contact/contact.module
Implements hook_mail().
CustomBlockBlock::build in drupal/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php
Builds and returns the renderable array for this block plugin.

... See full list

2 string references to 'entity_view'
custom_block_test_menu in drupal/core/modules/block/custom_block/tests/modules/custom_block_test/custom_block_test.module
Implements hook_menu().
EntityRenderController::viewMultiple in drupal/core/lib/Drupal/Core/Entity/EntityRenderController.php
Implements \Drupal\Core\Entity\EntityRenderControllerInterface::viewMultiple().

File

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

Code

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