You are here

protected function RouteSubscriber::alterRoutes in Menu Link Clone 8.3

Same name and namespace in other branches
  1. 8 src/Routing/RouteSubscriber.php \Drupal\menu_link_clone\Routing\RouteSubscriber::alterRoutes()
  2. 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\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  $menu = $this->entityTypeManager
    ->getDefinition('menu')
    ->id();
  if ($menu) {
    if ($route = $collection
      ->get("entity.{$menu}.clone_form")) {
      $route
        ->setDefault('_form', '\\Drupal\\menu_link_clone\\Form\\EntityMenuLinkCloneForm');
    }
  }
}