public function UcCountryServiceProvider::alter in Ubercart 8.4
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceProviderBase::alter
File
- uc_country/
src/ UcCountryServiceProvider.php, line 17
Class
- UcCountryServiceProvider
- Substitutes the uc_country manager service for the core country_manager.
Namespace
Drupal\uc_countryCode
public function alter(ContainerBuilder $container) {
$definition = $container
->getDefinition('country_manager');
// Overrides country_manager class to add additional functionality.
$definition
->setClass('Drupal\\uc_country\\CountryManager');
// Inject the entity_type.manager and string_translation services,
// which are not available in the core country_manager.
$definition
->addArgument(new Reference('entity_type.manager'));
$definition
->addArgument(new Reference('string_translation'));
}