function ModuleHandler::buildHookInfo

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::buildHookInfo()
  2. 8.9.x core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::buildHookInfo()
  3. 10 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::buildHookInfo()

Builds hook_hook_info() information.

See also

\Drupal\Core\Extension\ModuleHandler::getHookInfo()

1 call to ModuleHandler::buildHookInfo()
ModuleHandler::getHookInfo in core/lib/Drupal/Core/Extension/ModuleHandler.php
Retrieves a list of hooks that are declared through hook_hook_info().

File

core/lib/Drupal/Core/Extension/ModuleHandler.php, line 309

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

protected function buildHookInfo() {
    $this->hookInfo = [];
    // Make sure that the modules are loaded before checking.
    $this->reload();
    // $this->invokeAll() would cause an infinite recursion.
    foreach ($this->moduleList as $module => $filename) {
        $function = $module . '_hook_info';
        if (function_exists($function)) {
            $result = $function();
            if (isset($result) && is_array($result)) {
                $this->hookInfo = NestedArray::mergeDeep($this->hookInfo, $result);
            }
        }
    }
}

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