3 namespace Drupal\entityqueue;
5 use Drupal\Component\Plugin\PluginManagerInterface;
6 use Drupal\Core\Plugin\DefaultSingleLazyPluginCollection;
9 * Provides a container for lazily loading EntityQueueHandler plugins.
11 class EntityQueueHandlerPluginCollection extends DefaultSingleLazyPluginCollection {
14 * The entity queue that is using this plugin collection.
16 * @var \Drupal\entityqueue\Entity\EntityQueue
21 * Constructs a new EntityQueueHandlerPluginCollection.
23 * @param \Drupal\Component\Plugin\PluginManagerInterface $manager
24 * The manager to be used for instantiating plugins.
25 * @param string $instance_id
26 * The ID of the plugin instance.
27 * @param array $configuration
28 * An array of configuration.
29 * @param \Drupal\entityqueue\EntityQueueInterface $queue
30 * The entity queue using this plugin.
32 public function __construct(PluginManagerInterface $manager, $instance_id, array $configuration, EntityQueueInterface $queue) {
33 parent::__construct($manager, $instance_id, $configuration);
35 $this->queue = $queue;
41 * @return \Drupal\entityqueue\EntityQueueHandlerInterface
43 public function &get($instance_id) {
44 return parent::get($instance_id);
50 protected function initializePlugin($instance_id) {
51 parent::initializePlugin($instance_id);
53 $this->pluginInstances[$instance_id]->setQueue($this->queue);
59 public function addInstanceId($id, $configuration = NULL) {
60 // @todo Open a core bug report, the parent class should take care of this..
61 $this->instanceId = $id;
62 $this->instanceIDs = array_filter($this->instanceIDs);
64 parent::addInstanceId($id, $configuration);