class CommercePriceServiceProvider in Commerce Core 8.2
Swaps the default physical.number_formatter service class.
Hierarchy
- class \Drupal\Core\DependencyInjection\ServiceProviderBase implements ServiceModifierInterface, ServiceProviderInterface
- class \Drupal\commerce_price\CommercePriceServiceProvider
Expanded class hierarchy of CommercePriceServiceProvider
File
- modules/
price/ src/ CommercePriceServiceProvider.php, line 12
Namespace
Drupal\commerce_priceView source
class CommercePriceServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
if ($container
->hasDefinition('physical.number_formatter')) {
$container
->getDefinition('physical.number_formatter')
->setClass(PhysicalNumberFormatter::class)
->setArguments([
new Reference('commerce_price.number_format_repository'),
new Reference('commerce.current_locale'),
]);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommercePriceServiceProvider:: |
public | function |
Modifies existing service definitions. Overrides ServiceProviderBase:: |
|
ServiceProviderBase:: |
public | function |
Registers services to the container. Overrides ServiceProviderInterface:: |
1 |