class CommercePromotionServiceProvider in Commerce Core 8.2
Registers event subscribers for installed Commerce modules.
Hierarchy
- class \Drupal\Core\DependencyInjection\ServiceProviderBase implements ServiceModifierInterface, ServiceProviderInterface
- class \Drupal\commerce_promotion\CommercePromotionServiceProvider
Expanded class hierarchy of CommercePromotionServiceProvider
File
- modules/
promotion/ src/ CommercePromotionServiceProvider.php, line 12
Namespace
Drupal\commerce_promotionView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommercePromotionServiceProvider:: |
public | function |
Registers services to the container. Overrides ServiceProviderBase:: |
|
ServiceProviderBase:: |
public | function |
Modifies existing service definitions. Overrides ServiceModifierInterface:: |
5 |