You are here

protected function OpignoActivityHtmlRouteProvider::getRevisionViewRoute in Opigno module 3.x

Same name and namespace in other branches
  1. 8 src/OpignoActivityHtmlRouteProvider.php \Drupal\opigno_module\OpignoActivityHtmlRouteProvider::getRevisionViewRoute()

Gets the revision preview 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 OpignoActivityHtmlRouteProvider::getRevisionViewRoute()
OpignoActivityHtmlRouteProvider::getRoutes in src/OpignoActivityHtmlRouteProvider.php
Provides routes for entities.

File

src/OpignoActivityHtmlRouteProvider.php, line 142

Class

OpignoActivityHtmlRouteProvider
Provides routes for Activity entities.

Namespace

Drupal\opigno_module

Code

protected function getRevisionViewRoute(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->hasLinkTemplate('revision-preview')) {
    $route = new Route($entity_type
      ->getLinkTemplate('revision-preview'));
    $route
      ->setDefaults([
      '_title' => "{$entity_type->getLabel()} revisions",
      '_controller' => '\\Drupal\\opigno_module\\Controller\\ActivityRevisionsController::previewActivityRevision',
    ])
      ->setOption('parameters', [
      'opigno_activity' => [
        'type' => 'entity:opigno_activity',
      ],
      'opigno_activity_revision',
    ])
      ->setRequirement('_permission', 'access activity revisions')
      ->setRequirement('opigno_activity_revision', '\\d+')
      ->setOption('_admin_route', TRUE);
    return $route;
  }
}