You are here

public function CommerceCartFlyoutServiceProvider::alter in Commerce Cart Flyout 8

Modifies existing service definitions.

Parameters

ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.

Overrides ServiceProviderBase::alter

File

src/CommerceCartFlyoutServiceProvider.php, line 18

Class

CommerceCartFlyoutServiceProvider
Replaces the add to cart message.

Namespace

Drupal\commerce_cart_flyout

Code

public function alter(ContainerBuilder $container) {

  // Replace the server side add to cart messaging.
  if ($container
    ->hasDefinition('commerce_cart.cart_subscriber')) {
    $definition = $container
      ->getDefinition('commerce_cart.cart_subscriber');
    $definition
      ->setClass(CartEventSubscriber::class)
      ->addArgument(new Reference('current_route_match'));
  }
}