You are here

protected function RouteSubscriber::alterRoutes in Opigno Learning path 3.x

Same name and namespace in other branches
  1. 8 src/Routing/RouteSubscriber.php \Drupal\opigno_learning_path\Routing\RouteSubscriber::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/Routing/RouteSubscriber.php, line 16

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\opigno_learning_path\Routing

Code

protected function alterRoutes(RouteCollection $collection) {

  // Alters '/group/{group}/members' route path from Group module
  // to use this path in custom controller.
  if ($route = $collection
    ->get('view.group_members.page_1')) {
    $route
      ->setPath('/group/{group}/members/default');
  }
  if ($route = $collection
    ->get('entity.group.join')) {
    $route
      ->setRequirement('_entity_access', 'group.join');
  }
  if ($route = $collection
    ->get('view.opigno_classes.all')) {
    $route
      ->setOption('_admin_route', TRUE);
  }
}