protected function RouteSubscriber::alterRoutes in RedHen CRM 8
Same name in this branch
- 8 src/Routing/RouteSubscriber.php \Drupal\redhen\Routing\RouteSubscriber::alterRoutes()
- 8 modules/redhen_connection/src/Routing/RouteSubscriber.php \Drupal\redhen_connection\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 18
Class
- RouteSubscriber
- Set Admin Route options.
Namespace
Drupal\redhen\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
if (\Drupal::config('redhen.settings')
->get('redhen_admin_path')) {
$redhen_routes = [
'redhen.dashboard',
'entity.redhen_contact.canonical',
'entity.redhen_connection.canonical',
'entity.redhen_org.canonical',
];
foreach ($redhen_routes as $routename) {
$route = $collection
->get($routename);
if ($route) {
$route
->setOption('_admin_route', TRUE);
}
}
}
}