protected function GroupLatestRevisionRouteSubscriber::alterRoutes in Group 8
Same name and namespace in other branches
- 2.0.x 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\RoutingCode
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);
}
}