UcCountryServiceProvider.php in Ubercart 8.4
Namespace
Drupal\uc_countryFile
uc_country/src/UcCountryServiceProvider.phpView source
<?php
namespace Drupal\uc_country;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Symfony\Component\DependencyInjection\Reference;
/**
* Substitutes the uc_country manager service for the core country_manager.
*/
class UcCountryServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
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'));
}
}
Classes
Name![]() |
Description |
---|---|
UcCountryServiceProvider | Substitutes the uc_country manager service for the core country_manager. |