You are here

class CommercePromotionServiceProvider in Commerce Core 8.2

Registers event subscribers for installed Commerce modules.

Hierarchy

Expanded class hierarchy of CommercePromotionServiceProvider

File

modules/promotion/src/CommercePromotionServiceProvider.php, line 12

Namespace

Drupal\commerce_promotion
View source
class CommercePromotionServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container) {

    // We cannot use the module handler as the container is not yet compiled.
    // @see \Drupal\Core\DrupalKernel::compileContainer()
    $modules = $container
      ->getParameter('container.modules');
    if (isset($modules['commerce_cart'])) {
      $container
        ->register('commerce_promotion.cart_subscriber', CartEventSubscriber::class)
        ->addTag('event_subscriber');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommercePromotionServiceProvider::register public function Registers services to the container. Overrides ServiceProviderBase::register
ServiceProviderBase::alter public function Modifies existing service definitions. Overrides ServiceModifierInterface::alter 5