You are here

public function YamlFormElementManager::getInstances in YAML Form 8

Get all available form element plugin instances.

Return value

\Drupal\yamlform\YamlFormElementInterface[] An array of all available form element plugin instances.

Overrides YamlFormElementManagerInterface::getInstances

2 calls to YamlFormElementManager::getInstances()
YamlFormElementManager::getAllProperties in src/YamlFormElementManager.php
Get all properties for all elements.
YamlFormElementManager::getTranslatableProperties in src/YamlFormElementManager.php
Get all translatable properties from all elements.

File

src/YamlFormElementManager.php, line 76

Class

YamlFormElementManager
Provides a plugin manager for form element plugins.

Namespace

Drupal\yamlform

Code

public function getInstances() {
  $plugin_definitions = $this
    ->getDefinitions();
  $plugin_definitions = $this
    ->getSortedDefinitions($plugin_definitions);

  // If all the plugin definitions are initialize returned the cached
  // instances.
  if (count($plugin_definitions) == count($this->instances)) {
    return $this->instances;
  }

  // Initialize and return all plugin instances.
  foreach ($plugin_definitions as $plugin_id => $plugin_definition) {
    $this
      ->createInstance($plugin_id);
  }
  return $this->instances;
}