Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityRevisionViewController.php

function EntityRevisionViewController::__invoke

Provides a page to render a single entity revision.

Parameters

\Drupal\Core\Entity\RevisionableInterface $_entity_revision: The Entity to be rendered. Note this variable is named $_entity_revision 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.

File

core/lib/Drupal/Core/Entity/Controller/EntityRevisionViewController.php, line 70

Class

EntityRevisionViewController
Defines a controller to view an entity revision.

Namespace

Drupal\Core\Entity\Controller

Code

public function __invoke(RevisionableInterface $_entity_revision, string $view_mode = 'full') : array {
    $entityTypeId = $_entity_revision->getEntityTypeId();
    $page = $this->entityTypeManager
        ->getViewBuilder($entityTypeId)
        ->view($_entity_revision, $view_mode);
    $page['#entity_type'] = $entityTypeId;
    $page['#' . $entityTypeId] = $_entity_revision;
    return $page;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal