function HookDiscovery::getDefinitions

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php \Drupal\Core\Plugin\Discovery\HookDiscovery::getDefinitions()
  2. 8.9.x core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php \Drupal\Core\Plugin\Discovery\HookDiscovery::getDefinitions()
  3. 10 core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php \Drupal\Core\Plugin\Discovery\HookDiscovery::getDefinitions()

Overrides DiscoveryTrait::getDefinitions

File

core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php, line 47

Class

HookDiscovery
Provides a hook-based plugin discovery class.

Namespace

Drupal\Core\Plugin\Discovery

Code

public function getDefinitions() {
    $definitions = [];
    $this->moduleHandler
        ->invokeAllWith($this->hook, function (callable $hook, string $module) use (&$definitions) {
        $module_definitions = $hook();
        foreach ($module_definitions as $plugin_id => $definition) {
            $definition['provider'] = $module;
            $definitions[$plugin_id] = $definition;
        }
    });
    return $definitions;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.