protected function YamlFormRouteSubscriber::alterRoutes in YAML Form 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/ YamlFormRouteSubscriber.php, line 16
Class
- YamlFormRouteSubscriber
- Adds the _admin_route option to form routes.
Namespace
Drupal\yamlform\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
foreach ($collection
->all() as $route) {
if (!$route
->hasOption('_admin_route') && (strpos($route
->getPath(), '/admin/structure/yamlform/') === 0 || strpos($route
->getPath(), '/yamlform/results/') !== FALSE)) {
$route
->setOption('_admin_route', TRUE);
}
}
}