protected function ModuleHandler::getImplementationInfo

Provides information about modules' implementations of a hook.

Parameters

string $hook: The name of the hook (e.g. "help" or "menu").

Return value

array An array whose keys are the names of the modules which are implementing this hook and whose values are either an array of information from hook_hook_info() or FALSE if the implementation is in the module file.

2 calls to ModuleHandler::getImplementationInfo()
1 method overrides ModuleHandler::getImplementationInfo()

File

drupal/core/lib/Drupal/Core/Extension/ModuleHandler.php, line 449
Contains Drupal\Core\Extension\ModuleHandler.

Class

ModuleHandler
Class that manages enabled modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

protected function getImplementationInfo($hook) {
  if (isset($this->implementations[$hook])) {
    return $this->implementations[$hook];
  }
  $this->implementations[$hook] = array();
  $hook_info = $this
    ->getHookInfo();
  foreach ($this->moduleList as $module => $filename) {
    $include_file = isset($hook_info[$hook]['group']) && $this
      ->loadInclude($module, 'inc', $module . '.' . $hook_info[$hook]['group']);

    // Since $this->hookImplements() may needlessly try to load the include
    // file again, function_exists() is used directly here.
    if (function_exists($module . '_' . $hook)) {
      $this->implementations[$hook][$module] = $include_file ? $hook_info[$hook]['group'] : FALSE;
    }
  }

  // Allow modules to change the weight of specific implementations but avoid
  // an infinite loop.
  if ($hook != 'module_implements_alter') {
    $this
      ->alter('module_implements', $this->implementations[$hook], $hook);
  }
  return $this->implementations[$hook];
}