function PluginManager::__construct
PluginManager constructor.
This plugin manager depends on the URL generator to ensure that this service is instantiated during module installation when the plugin caches are cleared.
Parameters
\Traversable $namespaces: An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations.
\Drupal\Core\Cache\CacheBackendInterface $cache_backend: A cache backend.
\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.
\Drupal\Core\Routing\UrlGeneratorInterface $url_generator: The URL generator.
Overrides DefaultPluginManager::__construct
File
- 
              core/modules/ system/ tests/ modules/ lazy_route_provider_install_test/ src/ PluginManager.php, line 36 
Class
- PluginManager
- Plugin manager for testing the lazy route provider during module install.
Namespace
Drupal\lazy_route_provider_install_testCode
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, UrlGeneratorInterface $url_generator) {
  // Generate a URL during construction to prove that URL generation works. If
  // the route was missing an exception would be thrown. This also forces the
  // route provider to be initialized very early during a module install.
  \Drupal::state()->set(__CLASS__, Url::fromRoute('system.admin')->toString());
  parent::__construct('Plugin/LazyRouteProviderInstallTest', $namespaces, $module_handler, NULL, PluginID::class);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
