You are here

class TestLazyPluginCollection in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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

Expanded class hierarchy of TestLazyPluginCollection

File

core/modules/system/tests/modules/plugin_test/src/Plugin/TestLazyPluginCollection.php, line 16
Contains \Drupal\plugin_test\Plugin\TestLazyPluginCollection.

Namespace

Drupal\plugin_test\Plugin
View 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, array());
  }

  /**
   * {@inheritdoc}
   */
  public function getConfiguration() {
    return array();
  }

  /**
   * {@inheritdoc}
   */
  public function setConfiguration($configuration) {
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LazyPluginCollection::$instanceIDs protected property Stores the IDs of all potential plugin instances.
LazyPluginCollection::$pluginInstances protected property Stores all instantiated plugins.
LazyPluginCollection::addInstanceId public function Adds an instance ID to the available instance IDs. 2
LazyPluginCollection::clear public function Clears all instantiated plugins. 1
LazyPluginCollection::count public function
LazyPluginCollection::get public function Gets a plugin instance, initializing it if necessary. 8
LazyPluginCollection::getInstanceIds public function Gets all instance IDs.
LazyPluginCollection::getIterator public function
LazyPluginCollection::has public function Determines if a plugin instance exists.
LazyPluginCollection::remove public function Removes an initialized plugin. 1
LazyPluginCollection::removeInstanceId public function Removes an instance ID. 1
LazyPluginCollection::set public function Stores an initialized plugin.
TestLazyPluginCollection::$manager protected property Stores the plugin manager used by this collection.
TestLazyPluginCollection::getConfiguration public function Gets the current configuration of all plugins in this collection. Overrides LazyPluginCollection::getConfiguration
TestLazyPluginCollection::initializePlugin protected function Initializes and stores a plugin. Overrides LazyPluginCollection::initializePlugin
TestLazyPluginCollection::setConfiguration public function Sets the configuration for all plugins in this collection. Overrides LazyPluginCollection::setConfiguration
TestLazyPluginCollection::__construct public function Constructs a TestLazyPluginCollection object.