protected function RouteSubscriber::alterRoutes in Opigno statistics 3.x
Same name and namespace in other branches
- 8 src/EventSubscriber/RouteSubscriber.php \Drupal\opigno_statistics\EventSubscriber\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/
EventSubscriber/ RouteSubscriber.php, line 16
Class
- RouteSubscriber
- Class RouteSubscriber.
Namespace
Drupal\opigno_statistics\EventSubscriberCode
protected function alterRoutes(RouteCollection $collection) {
// Replace default user profile route.
$user_page = $collection
->get('opigno_statistics.user');
if (isset($user_page)) {
$default_user_page_key = 'entity.user.canonical';
$default_user_page = $collection
->get($default_user_page_key);
$user_page
->setPath($default_user_page
->getPath());
$collection
->remove($default_user_page_key);
$collection
->add($default_user_page_key, $user_page);
}
}