class PluginManagerDecorator in Plugin 8.2
Provides a plugin manager decorator.
Hierarchy
- class \Drupal\plugin\PluginDiscovery\PluginDiscoveryDecorator implements CachedDiscoveryInterface, DiscoveryInterface uses DiscoveryTrait, DependencySerializationTrait
- class \Drupal\plugin\PluginManager\PluginManagerDecorator implements PluginManagerInterface
Expanded class hierarchy of PluginManagerDecorator
2 files declare their use of PluginManagerDecorator
- AdvancedPluginSelectorBasePluginSelectorForm.php in tests/
modules/ plugin_test_helper/ src/ AdvancedPluginSelectorBasePluginSelectorForm.php - PluginManagerDecoratorTest.php in tests/
src/ Unit/ PluginManager/ PluginManagerDecoratorTest.php
File
- src/
PluginManager/ PluginManagerDecorator.php, line 13
Namespace
Drupal\plugin\PluginManagerView source
class PluginManagerDecorator extends PluginDiscoveryDecorator implements PluginManagerInterface {
/**
* The decorated plugin factory.
*
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
protected $decoratedFactory;
/**
* Creates a new instance.
*
* @param \Drupal\Component\Plugin\PluginManagerInterface $plugin_manager
* The decorated plugin manager.
* @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface|null $discovery
* A plugin discovery to use instead of the decorated plugin manager, or
* NULL to use the decorated plugin manager.
*/
public function __construct(PluginManagerInterface $plugin_manager, DiscoveryInterface $discovery = NULL) {
$this->decoratedDiscovery = $discovery ? $discovery : $plugin_manager;
$this->decoratedFactory = $plugin_manager;
}
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, array $configuration = []) {
if ($this
->hasDefinition($plugin_id)) {
return $this->decoratedFactory
->createInstance($plugin_id, $configuration);
}
else {
throw new PluginNotFoundException($plugin_id);
}
}
/**
* {@inheritdoc}
*/
public function getInstance(array $options) {
throw new \BadMethodCallException('This method is not supported. See https://www.drupal.org/node/1894130.');
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
DiscoveryTrait:: |
protected | function | Gets a specific plugin definition. | |
DiscoveryTrait:: |
public | function | 3 | |
DiscoveryTrait:: |
public | function | ||
PluginDiscoveryDecorator:: |
protected | property | The decorated discovery. | |
PluginDiscoveryDecorator:: |
protected | property | The processed plugin definitions. | |
PluginDiscoveryDecorator:: |
protected | property | Whether or not to use plugin caching. | |
PluginDiscoveryDecorator:: |
public | function |
Clears static and persistent plugin definition caches. Overrides CachedDiscoveryInterface:: |
|
PluginDiscoveryDecorator:: |
public | function |
Gets the definition of all plugins for this type. Overrides DiscoveryTrait:: |
|
PluginDiscoveryDecorator:: |
protected | function | Processes the definitions from the decorated discovery. | 2 |
PluginDiscoveryDecorator:: |
public | function |
Disable the use of caches. Overrides CachedDiscoveryInterface:: |
|
PluginManagerDecorator:: |
protected | property | The decorated plugin factory. | |
PluginManagerDecorator:: |
public | function |
Creates a pre-configured instance of a plugin. Overrides FactoryInterface:: |
|
PluginManagerDecorator:: |
public | function |
Gets a preconfigured instance of a plugin. Overrides MapperInterface:: |
|
PluginManagerDecorator:: |
public | function |
Creates a new instance. Overrides PluginDiscoveryDecorator:: |