You are here

protected function RevisionRouteProvider::getRevisionHistoryRoute in Entity API 8

Same name and namespace in other branches
  1. 8.0 src/Routing/RevisionRouteProvider.php \Drupal\entity\Routing\RevisionRouteProvider::getRevisionHistoryRoute()

Gets the entity revision version history route.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

1 call to RevisionRouteProvider::getRevisionHistoryRoute()
RevisionRouteProvider::getRoutes in src/Routing/RevisionRouteProvider.php
Provides routes for entities.

File

src/Routing/RevisionRouteProvider.php, line 108

Class

RevisionRouteProvider
Provides revision routes.

Namespace

Drupal\entity\Routing

Code

protected function getRevisionHistoryRoute(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->hasLinkTemplate('version-history')) {
    $entity_type_id = $entity_type
      ->id();
    $route = new Route($entity_type
      ->getLinkTemplate('version-history'));
    $route
      ->addDefaults([
      '_controller' => '\\Drupal\\entity\\Controller\\RevisionOverviewController::revisionOverviewController',
      '_title' => 'Revisions',
    ]);
    $route
      ->setRequirement('_entity_access_revision', "{$entity_type_id}.list");
    $route
      ->setOption('entity_type_id', $entity_type
      ->id());
    $route
      ->setOption('parameters', [
      $entity_type
        ->id() => [
        'type' => 'entity:' . $entity_type
          ->id(),
      ],
    ]);
    return $route;
  }
}