You are here

protected function RouteSubscriber::alterRoutes in Commerce AutoSKU 8.2

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 42
Contains \Drupal\commerce_autosku\Routing\RouteSubscriber.

Class

RouteSubscriber
Subscriber for commerce_autosku routes.

Namespace

Drupal\commerce_autosku\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  $entity_type_id = 'commerce_product_variation_type';
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity_type_id);
  if ($route = $this
    ->getEntityAutoSkuRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.auto_sku", $route);
  }
}