You are here

protected function RouteSubscriber::alterRoutes in Entity Clone 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/RouteSubscriber.php, line 37

Class

RouteSubscriber
Subscriber for Entity Clone routes.

Namespace

Drupal\entity_clone\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if ($route = $this
      ->getEntityCloneRoute($entity_type)) {
      $collection
        ->add("entity.{$entity_type_id}.clone_form", $route);
    }
  }
}