You are here

public function HookDiscovery::getDefinitions in Plug 7

Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().

Overrides DiscoveryTrait::getDefinitions

File

lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php, line 52
Contains \Drupal\Core\Plugin\Discovery\HookDiscovery.

Class

HookDiscovery
Provides a hook-based plugin discovery class.

Namespace

Drupal\Core\Plugin\Discovery

Code

public function getDefinitions() {
  $definitions = array();
  foreach ($this->moduleHandler
    ->getImplementations($this->hook) as $module) {
    $result = $this->moduleHandler
      ->invoke($module, $this->hook);
    foreach ($result as $plugin_id => $definition) {
      $definition['provider'] = $module;
      $definitions[$plugin_id] = $definition;
    }
  }
  return $definitions;
}