protected function RouteSubscriber::alterRoutes in Menu Link Clone 8
Same name and namespace in other branches
- 8.3 src/Routing/RouteSubscriber.php \Drupal\menu_link_clone\Routing\RouteSubscriber::alterRoutes()
- 8.2 src/Routing/RouteSubscriber.php \Drupal\menu_link_clone\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 33
Class
- RouteSubscriber
- Listens to the dynamic route events.
Namespace
Drupal\menu_link_clone\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type_id == 'menu') {
if ($route = $collection
->get("entity.{$entity_type_id}.clone_form")) {
$route
->setDefault('_form', '\\Drupal\\menu_link_clone\\Form\\EntityMenuLinkCloneForm');
}
}
}
}