protected function Fz152RouteSubscriber::alterRoutes in FZ152 8
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/ Fz152RouteSubscriber.php, line 34
Class
- Fz152RouteSubscriber
- Listens to the dynamic trousers route events.
Namespace
Drupal\fz152\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
// Try to get the route from the current collection.
$name = 'fz152.privacy_policy_page';
if ($route = $collection
->get($name)) {
$config = $this->configFactory
->get($name);
if ($config
->get('enable')) {
$route
->setPath($config
->get('path'));
}
else {
$collection
->remove($name);
}
}
}