You are here

public function PriceServiceProvider::alter in Price 2.0.x

Modifies existing service definitions.

Parameters

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

Overrides ServiceProviderBase::alter

File

src/PriceServiceProvider.php, line 17

Class

PriceServiceProvider
Swaps the default physical.number_formatter service class.

Namespace

Drupal\price

Code

public function alter(ContainerBuilder $container) {
  if ($container
    ->hasDefinition('physical.number_formatter')) {
    $container
      ->getDefinition('physical.number_formatter')
      ->setClass(PhysicalNumberFormatter::class)
      ->setArguments([
      new Reference('price.number_format_repository'),
      new Reference('price.current_locale'),
    ]);
  }
}