public function HookDiscovery::getDefinitions in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php \Drupal\Core\Plugin\Discovery\HookDiscovery::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/ HookDiscovery.php, line 47
Class
- HookDiscovery
- Provides a hook-based plugin discovery class.
Namespace
Drupal\Core\Plugin\DiscoveryCode
public function getDefinitions() {
$definitions = [];
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;
}