You are here

public function InfoHookDecorator::getDefinitions in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Discovery/InfoHookDecorator.php \Drupal\Core\Plugin\Discovery\InfoHookDecorator::getDefinitions()

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

See also

\Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions()

File

core/lib/Drupal/Core/Plugin/Discovery/InfoHookDecorator.php, line 45

Class

InfoHookDecorator
Allows info hook implementations to enhance discovered plugin definitions.

Namespace

Drupal\Core\Plugin\Discovery

Code

public function getDefinitions() {
  $definitions = $this->decorated
    ->getDefinitions();
  foreach (\Drupal::moduleHandler()
    ->getImplementations($this->hook) as $module) {
    $function = $module . '_' . $this->hook;
    $function($definitions);
  }
  return $definitions;
}