You are here

class RouteSubscriber in Commerce Pricelist 8.2

Hierarchy

  • class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber'
commerce_pricelist.services.yml in ./commerce_pricelist.services.yml
commerce_pricelist.services.yml
1 service uses RouteSubscriber
commerce_pricelist.route_subscriber in ./commerce_pricelist.services.yml
Drupal\commerce_pricelist\EventSubscriber\RouteSubscriber

File

src/EventSubscriber/RouteSubscriber.php, line 8

Namespace

Drupal\commerce_pricelist\EventSubscriber
View source
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  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);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1