class TestLazyPluginCollection in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/plugin_test/src/Plugin/TestLazyPluginCollection.php \Drupal\plugin_test\Plugin\TestLazyPluginCollection
- 9 core/modules/system/tests/modules/plugin_test/src/Plugin/TestLazyPluginCollection.php \Drupal\plugin_test\Plugin\TestLazyPluginCollection
Defines a plugin collection which uses fruit plugins.
Hierarchy
- class \Drupal\Component\Plugin\LazyPluginCollection implements \Drupal\Component\Plugin\IteratorAggregate, \Drupal\Component\Plugin\Countable
- class \Drupal\plugin_test\Plugin\TestLazyPluginCollection
Expanded class hierarchy of TestLazyPluginCollection
File
- core/
modules/ system/ tests/ modules/ plugin_test/ src/ Plugin/ TestLazyPluginCollection.php, line 11
Namespace
Drupal\plugin_test\PluginView source
class TestLazyPluginCollection extends LazyPluginCollection {
/**
* Stores the plugin manager used by this collection.
*
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
protected $manager;
/**
* Constructs a TestLazyPluginCollection object.
*
* @param \Drupal\Component\Plugin\PluginManagerInterface $manager
* The plugin manager that handles test plugins.
*/
public function __construct(PluginManagerInterface $manager) {
$this->manager = $manager;
$instance_ids = array_keys($this->manager
->getDefinitions());
$this->instanceIds = array_combine($instance_ids, $instance_ids);
}
/**
* {@inheritdoc}
*/
protected function initializePlugin($instance_id) {
$this->pluginInstances[$instance_id] = $this->manager
->createInstance($instance_id, []);
}
/**
* {@inheritdoc}
*/
public function getConfiguration() {
return [];
}
/**
* {@inheritdoc}
*/
public function setConfiguration($configuration) {
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LazyPluginCollection:: |
protected | property | Stores the IDs of all potential plugin instances. | |
LazyPluginCollection:: |
protected | property | Stores all instantiated plugins. | |
LazyPluginCollection:: |
public | function | Adds an instance ID to the available instance IDs. | |
LazyPluginCollection:: |
public | function | Clears all instantiated plugins. | |
LazyPluginCollection:: |
public | function | ||
LazyPluginCollection:: |
public | function | Gets a plugin instance, initializing it if necessary. | 1 |
LazyPluginCollection:: |
public | function | Gets all instance IDs. | |
LazyPluginCollection:: |
public | function | ||
LazyPluginCollection:: |
public | function | Determines if a plugin instance exists. | |
LazyPluginCollection:: |
public | function | Removes an initialized plugin. | |
LazyPluginCollection:: |
public | function | Removes an instance ID. | |
LazyPluginCollection:: |
public | function | Stores an initialized plugin. | |
TestLazyPluginCollection:: |
protected | property | Stores the plugin manager used by this collection. | |
TestLazyPluginCollection:: |
public | function |
Gets the current configuration of all plugins in this collection. Overrides LazyPluginCollection:: |
|
TestLazyPluginCollection:: |
protected | function |
Initializes and stores a plugin. Overrides LazyPluginCollection:: |
|
TestLazyPluginCollection:: |
public | function |
Sets the configuration for all plugins in this collection. Overrides LazyPluginCollection:: |
|
TestLazyPluginCollection:: |
public | function | Constructs a TestLazyPluginCollection object. |