You are here

public function PromotionRouteProvider::getRoutes in Commerce Core 8.2

Provides routes for entities.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type

Return value

\Symfony\Component\Routing\RouteCollection|\Symfony\Component\Routing\Route[] Returns a route collection or an array of routes keyed by name, like route_callbacks inside 'routing.yml' files.

Overrides AdminHtmlRouteProvider::getRoutes

File

modules/promotion/src/PromotionRouteProvider.php, line 17

Class

PromotionRouteProvider
Provides routes for the Promotion entity.

Namespace

Drupal\commerce_promotion

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = parent::getRoutes($entity_type);
  foreach ([
    'enable',
    'disable',
  ] as $operation) {
    if ($form_route = $this
      ->getPromotionFormRoute($entity_type, $operation)) {
      $collection
        ->add('entity.commerce_promotion.' . $operation . '_form', $form_route);
    }
  }
  return $collection;
}