You are here

public function YamlDiscovery::getDefinitions in Plug 7

Gets the definition of all plugins for this type.

Return value

mixed[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

Overrides DiscoveryTrait::getDefinitions

1 call to YamlDiscovery::getDefinitions()
YamlDiscoveryDecorator::getDefinitions in lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php
Gets the definition of all plugins for this type.
1 method overrides YamlDiscovery::getDefinitions()
YamlDiscoveryDecorator::getDefinitions in lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php
Gets the definition of all plugins for this type.

File

lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php, line 44
Contains \Drupal\Core\Plugin\Discovery\YamlDiscovery.

Class

YamlDiscovery
Allows YAML files to define plugin definitions.

Namespace

Drupal\Core\Plugin\Discovery

Code

public function getDefinitions() {
  $plugins = $this->discovery
    ->findAll();

  // Flatten definitions into what's expected from plugins.
  $definitions = array();
  foreach ($plugins as $provider => $list) {
    foreach ($list as $id => $definition) {
      $definitions[$id] = $definition + array(
        'provider' => $provider,
        'id' => $id,
      );
    }
  }
  return $definitions;
}