class TestPluginManager
Same name in this branch
- 9 core/modules/system/tests/modules/plugin_test/src/Plugin/TestPluginManager.php \Drupal\plugin_test\Plugin\TestPluginManager
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/plugin_test/src/Plugin/TestPluginManager.php \Drupal\plugin_test\Plugin\TestPluginManager
- 11.x core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php \Drupal\Tests\Core\Plugin\TestPluginManager
- 10 core/modules/system/tests/modules/plugin_test/src/Plugin/TestPluginManager.php \Drupal\plugin_test\Plugin\TestPluginManager
- 10 core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php \Drupal\Tests\Core\Plugin\TestPluginManager
- 8.9.x core/modules/system/tests/modules/plugin_test/src/Plugin/TestPluginManager.php \Drupal\plugin_test\Plugin\TestPluginManager
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php \Drupal\Tests\Core\Plugin\TestPluginManager
A plugin manager for condition plugins.
Hierarchy
- class \Drupal\Component\Plugin\PluginManagerBase extends \Drupal\Component\Plugin\PluginManagerInterface uses \Drupal\Component\Plugin\Discovery\DiscoveryTrait
- class \Drupal\Core\Plugin\DefaultPluginManager extends \Drupal\Component\Plugin\PluginManagerInterface, \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait, \Drupal\Core\Cache\UseCacheBackendTrait implements \Drupal\Component\Plugin\PluginManagerBase
- class \Drupal\Tests\Core\Plugin\TestPluginManager implements \Drupal\Core\Plugin\DefaultPluginManager
- class \Drupal\Core\Plugin\DefaultPluginManager extends \Drupal\Component\Plugin\PluginManagerInterface, \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait, \Drupal\Core\Cache\UseCacheBackendTrait implements \Drupal\Component\Plugin\PluginManagerBase
Expanded class hierarchy of TestPluginManager
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ TestPluginManager.php, line 13
Namespace
Drupal\Tests\Core\PluginView source
class TestPluginManager extends DefaultPluginManager {
/**
* Constructs a TestPluginManager object.
*
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
* keyed by the corresponding namespace to look for plugin implementations.
* @param array $definitions
* An array of static definitions.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* (optional) The module handler to invoke the alter hook with.
* @param string $alter_hook
* (optional) Name of the alter hook.
* @param string $interface
* (optional) The interface required for the plugins.
*/
public function __construct(\Traversable $namespaces, array $definitions, ModuleHandlerInterface $module_handler = NULL, $alter_hook = NULL, $interface = NULL) {
// Create the object that can be used to return definitions for all the
// plugins available for this type. Most real plugin managers use a richer
// discovery implementation, but StaticDiscovery lets us add some simple
// mock plugins for unit testing.
$this->discovery = new StaticDiscovery();
$this->factory = new DefaultFactory($this->discovery, $interface);
// Add the static definitions.
foreach ($definitions as $key => $definition) {
$this->discovery
->setDefinition($key, $definition);
}
$this->moduleHandler = $module_handler;
if ($alter_hook) {
$this->alterInfo($alter_hook);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.