RouteSubscriber.php in Opigno Learning path 3.x
File
src/Routing/RouteSubscriber.php
View source
<?php
namespace Drupal\opigno_learning_path\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
class RouteSubscriber extends RouteSubscriberBase {
protected function alterRoutes(RouteCollection $collection) {
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);
}
}
}