You are here

public function RevisionController::viewTitle in Workspace 8

Title callback for view routes.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: A RouteMatch object.

Return value

array Array of page elements to render.

File

src/Controller/RevisionController.php, line 21

Class

RevisionController

Namespace

Drupal\workspace\Controller

Code

public function viewTitle(RouteMatchInterface $route_match) {
  $parameter_name = $route_match
    ->getRouteObject()
    ->getOption('_entity_type_id');

  /** @var \Drupal\Core\Entity\ContentEntityInterface $entity **/
  $entity = $route_match
    ->getParameter($parameter_name);
  return $entity
    ->label();
}