You are here

protected function PetHtmlRouteProvider::getHistoryRoute in Previewable email templates 8.3

Gets the 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 PetHtmlRouteProvider::getHistoryRoute()
PetHtmlRouteProvider::getRoutes in src/PetHtmlRouteProvider.php
Provides routes for entities.

File

src/PetHtmlRouteProvider.php, line 74

Class

PetHtmlRouteProvider
Provides routes for pet entities.

Namespace

Drupal\pet

Code

protected function getHistoryRoute(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->hasLinkTemplate('version-history')) {
    $route = new Route($entity_type
      ->getLinkTemplate('version-history'));
    $route
      ->setDefaults([
      '_title' => "{$entity_type->getLabel()} revisions",
      '_controller' => '\\Drupal\\pet\\Controller\\PetRevisionController::revisionOverview',
    ])
      ->setRequirement('_permission', 'access pet revisions')
      ->setOption('_admin_route', TRUE);
    if (\Drupal::moduleHandler()
      ->moduleExists('diff')) {
      $route
        ->addDefaults(array(
        '_controller' => '\\Drupal\\pet\\Controller\\PetDiffRevisionController::revisionOverview',
      ));
    }
    return $route;
  }
}