public function ParagraphsBehaviorCollection::getAll

Retrieves all behavior plugins definitions and creates an instance for each one.

1 call to ParagraphsBehaviorCollection::getAll()
ParagraphsBehaviorCollection::getEnabled in paragraphs/src/ParagraphsBehaviorCollection.php
Retrieves all enabled behavior plugins.

File

paragraphs/src/ParagraphsBehaviorCollection.php, line 46

Class

ParagraphsBehaviorCollection
A collection of paragraphs behavior plugins.

Namespace

Drupal\paragraphs

Code

public function getAll() {

  // Retrieve all available behavior plugin definitions.
  if (!$this->definitions) {
    $this->definitions = $this->manager
      ->getDefinitions();
  }

  // Ensure that there is an instance of all available behavior plugins.
  // Note that getDefinitions() are keyed by $plugin_id. $instance_id is the
  // $plugin_id for behavior plugins, since a single behavior plugin can only
  // exist once in a paragraphs type.
  foreach ($this->definitions as $plugin_id => $definition) {
    if (!isset($this->pluginInstances[$plugin_id])) {
      $this
        ->initializePlugin($plugin_id);
    }
  }
  return $this->pluginInstances;
}