You are here

protected function RouteSubscriber::alterRoutes in Commerce Pricelist 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/EventSubscriber/RouteSubscriber.php, line 13

Class

RouteSubscriber

Namespace

Drupal\commerce_pricelist\EventSubscriber

Code

protected function alterRoutes(RouteCollection $collection) {
  if ($route = $collection
    ->get('view.commerce_product_variation_prices.page')) {
    $route
      ->setOption('_admin_route', TRUE);
    $parameters = $route
      ->getOption('parameters') ?: [];
    $parameters['commerce_product']['type'] = 'entity:commerce_product';
    $parameters['commerce_product_variation']['type'] = 'entity:commerce_product_variation';
    $route
      ->setOption('parameters', $parameters);
  }
}