You are here

protected function FlaggingCollectionHtmlRouteProvider::getHistoryRoute in Flag Lists 8

Same name and namespace in other branches
  1. 4.0.x src/FlaggingCollectionHtmlRouteProvider.php \Drupal\flag_lists\FlaggingCollectionHtmlRouteProvider::getHistoryRoute()

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

File

src/FlaggingCollectionHtmlRouteProvider.php, line 61

Class

FlaggingCollectionHtmlRouteProvider
Provides routes for Flagging collection entities.

Namespace

Drupal\flag_lists

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\\flag_lists\\Controller\\FlaggingCollectionController::revisionOverview',
    ])
      ->setRequirement('_permission', 'access flagging collection revisions')
      ->setOption('_admin_route', TRUE);
    return $route;
  }
}