public function EntityViewController::view in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/Controller/EntityViewController.php \Drupal\Core\Entity\Controller\EntityViewController::view()
- 10 core/lib/Drupal/Core/Entity/Controller/EntityViewController.php \Drupal\Core\Entity\Controller\EntityViewController::view()
Provides a page to render a single entity.
Parameters
\Drupal\Core\Entity\EntityInterface $_entity: The Entity to be rendered. Note this variable is named $_entity rather than $entity to prevent collisions with other named placeholders in the route.
string $view_mode: (optional) The view mode that should be used to display the entity. Defaults to 'full'.
Return value
array A render array as expected by \Drupal\Core\Render\RendererInterface::render().
3 calls to EntityViewController::view()
- EntityViewController::viewRevision in core/
lib/ Drupal/ Core/ Entity/ Controller/ EntityViewController.php - Provides a page to render a single entity revision.
- NodePreviewController::view in core/
modules/ node/ src/ Controller/ NodePreviewController.php - Provides a page to render a single entity.
- NodeViewController::view in core/
modules/ node/ src/ Controller/ NodeViewController.php - Provides a page to render a single entity.
2 methods override EntityViewController::view()
- NodePreviewController::view in core/
modules/ node/ src/ Controller/ NodePreviewController.php - Provides a page to render a single entity.
- NodeViewController::view in core/
modules/ node/ src/ Controller/ NodeViewController.php - Provides a page to render a single entity.
File
- core/
lib/ Drupal/ Core/ Entity/ Controller/ EntityViewController.php, line 102
Class
- EntityViewController
- Defines a generic controller to render a single entity.
Namespace
Drupal\Core\Entity\ControllerCode
public function view(EntityInterface $_entity, $view_mode = 'full') {
$page = $this->entityTypeManager
->getViewBuilder($_entity
->getEntityTypeId())
->view($_entity, $view_mode);
$page['#pre_render'][] = [
$this,
'buildTitle',
];
$page['#entity_type'] = $_entity
->getEntityTypeId();
$page['#' . $page['#entity_type']] = $_entity;
return $page;
}