class PathAliasDeprecatedTestServiceProvider

Test service provider to test path alias deprecated services BC logic.

Hierarchy

Expanded class hierarchy of PathAliasDeprecatedTestServiceProvider

1 file declares its use of PathAliasDeprecatedTestServiceProvider
DeprecatedServicesTest.php in core/modules/path_alias/tests/src/Kernel/DeprecatedServicesTest.php

File

core/modules/path_alias/tests/modules/path_alias_deprecated_test/src/PathAliasDeprecatedTestServiceProvider.php, line 11

Namespace

Drupal\path_alias_deprecated_test
View source
class PathAliasDeprecatedTestServiceProvider implements ServiceModifierInterface {
  
  /**
   * The name of the new implementation class for the alias manager.
   *
   * @var string
   */
  public static $newClass;
  
  /**
   * Whether to use a decorator to wrap the alias manager implementation.
   *
   * @var bool
   */
  public static $useDecorator = FALSE;
  
  /**
   * {@inheritdoc}
   */
  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);
      }
    }
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
PathAliasDeprecatedTestServiceProvider::$newClass public static property The name of the new implementation class for the alias manager.
PathAliasDeprecatedTestServiceProvider::$useDecorator public static property Whether to use a decorator to wrap the alias manager implementation.
PathAliasDeprecatedTestServiceProvider::alter public function Modifies existing service definitions. Overrides ServiceModifierInterface::alter

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.