public function PathAliasDeprecatedTestServiceProvider::alter in Drupal 8
Modifies existing service definitions.
Parameters
ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.
Overrides ServiceModifierInterface::alter
File
- core/
modules/ path_alias/ tests/ modules/ path_alias_deprecated_test/ src/ PathAliasDeprecatedTestServiceProvider.php, line 30
Class
- PathAliasDeprecatedTestServiceProvider
- Test service provider to test path alias deprecated services BC logic.
Namespace
Drupal\path_alias_deprecated_testCode
public function alter(ContainerBuilder $container) {
if (isset(static::$newClass)) {
$definition = $container
->getDefinition('path.alias_manager');
$definition
->setClass(static::$newClass);
}
if (!static::$useDecorator) {
$decorator_id = 'path_alias_deprecated_test.path.alias_manager';
if ($container
->hasDefinition($decorator_id)) {
$container
->removeDefinition($decorator_id);
}
}
}