public function LanguageServiceProvider::register in Drupal 8
Same name and namespace in other branches
- 9 core/modules/language/src/LanguageServiceProvider.php \Drupal\language\LanguageServiceProvider::register()
Registers services to the container.
Parameters
ContainerBuilder $container: The ContainerBuilder to register services to.
Overrides ServiceProviderBase::register
File
- core/
modules/ language/ src/ LanguageServiceProvider.php, line 21
Class
- LanguageServiceProvider
- Overrides the language_manager service to point to language's module one.
Namespace
Drupal\languageCode
public function register(ContainerBuilder $container) {
// The following services are needed only on multilingual sites.
if ($this
->isMultilingual()) {
$container
->register('language_request_subscriber', 'Drupal\\language\\EventSubscriber\\LanguageRequestSubscriber')
->addTag('event_subscriber')
->addArgument(new Reference('language_manager'))
->addArgument(new Reference('language_negotiator'))
->addArgument(new Reference('string_translation'))
->addArgument(new Reference('current_user'));
$container
->register('path_processor_language', 'Drupal\\language\\HttpKernel\\PathProcessorLanguage')
->addTag('path_processor_inbound', [
'priority' => 300,
])
->addTag('path_processor_outbound', [
'priority' => 100,
])
->addArgument(new Reference('config.factory'))
->addArgument(new Reference('language_manager'))
->addArgument(new Reference('language_negotiator'))
->addArgument(new Reference('current_user'))
->addArgument(new Reference('language.config_subscriber'))
->addMethodCall('initConfigSubscriber');
}
}