class TestLazyPluginCollection
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/plugin_test/src/Plugin/TestLazyPluginCollection.php \Drupal\plugin_test\Plugin\TestLazyPluginCollection
- 10 core/modules/system/tests/modules/plugin_test/src/Plugin/TestLazyPluginCollection.php \Drupal\plugin_test\Plugin\TestLazyPluginCollection
- 8.9.x 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 extends \Drupal\Component\Plugin\LazyPluginCollection
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;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.