function LazyPluginCollection::getIterator

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Plugin/LazyPluginCollection.php \Drupal\Component\Plugin\LazyPluginCollection::getIterator()
  2. 10 core/lib/Drupal/Component/Plugin/LazyPluginCollection.php \Drupal\Component\Plugin\LazyPluginCollection::getIterator()
  3. 11.x core/lib/Drupal/Component/Plugin/LazyPluginCollection.php \Drupal\Component\Plugin\LazyPluginCollection::getIterator()

File

core/lib/Drupal/Component/Plugin/LazyPluginCollection.php, line 145

Class

LazyPluginCollection
Defines an object which stores multiple plugin instances to lazy load them.

Namespace

Drupal\Component\Plugin

Code

public function getIterator() {
    $instances = [];
    foreach ($this->getInstanceIds() as $instance_id) {
        $instances[$instance_id] = $this->get($instance_id);
    }
    return new \ArrayIterator($instances);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.