class RouteSubscriber in Opigno statistics 8
Same name and namespace in other branches
- 3.x src/EventSubscriber/RouteSubscriber.php \Drupal\opigno_statistics\EventSubscriber\RouteSubscriber
Class RouteSubscriber.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\opigno_statistics\EventSubscriber\RouteSubscriber
Expanded class hierarchy of RouteSubscriber
1 string reference to 'RouteSubscriber'
1 service uses RouteSubscriber
File
- src/
EventSubscriber/ RouteSubscriber.php, line 11
Namespace
Drupal\opigno_statistics\EventSubscriberView source
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
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);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |