You are here

protected function GroupLatestRevisionRouteSubscriber::alterRoutes in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/Routing/GroupLatestRevisionRouteSubscriber.php \Drupal\group\Entity\Routing\GroupLatestRevisionRouteSubscriber::alterRoutes()

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

src/Entity/Routing/GroupLatestRevisionRouteSubscriber.php, line 16

Class

GroupLatestRevisionRouteSubscriber
Swaps out the latest revision page access callback.

Namespace

Drupal\group\Entity\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  if ($route = $collection
    ->get('entity.group.latest_version')) {
    $requirements = $route
      ->getRequirements();
    unset($requirements['_content_moderation_latest_version']);
    $requirements['_group_latest_revision'] = 'TRUE';
    $route
      ->setRequirements($requirements);
  }
}