function HookCollectorPass::getImplementations

This method is only to be used by ModuleHandler.

@todo Remove when ModuleHandler::add() is removed in Drupal 12.0.0.

@internal

Return value

array<string, array<string, array<class-string, array<string, string>>>> Hook implementation method names keyed by hook, module, class and method.

File

core/lib/Drupal/Core/Hook/HookCollectorPass.php, line 550

Class

HookCollectorPass
Collects and registers hook implementations.

Namespace

Drupal\Core\Hook

Code

public function getImplementations() : array {
    $implementationsByHook = $this->getFilteredImplementations();
    // List of modules implementing hooks with the implementation details.
    $implementations = [];
    foreach ($implementationsByHook as $hook => $hookImplementations) {
        foreach ($this->modules as $module) {
            foreach (array_keys($hookImplementations, $module, TRUE) as $identifier) {
                [
                    $class,
                    $method,
                ] = explode('::', $identifier);
                $implementations[$hook][$module][$class][$method] = $method;
            }
        }
    }
    return $implementations;
}

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