public function ModuleHandler::implementsHook

Implements \Drupal\Core\Extension\ModuleHandlerInterface::implementsHook().

Overrides ModuleHandlerInterface::implementsHook

1 call to ModuleHandler::implementsHook()

File

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

Class

ModuleHandler
Class that manages enabled modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function implementsHook($module, $hook) {
  $function = $module . '_' . $hook;
  if (function_exists($function)) {
    return TRUE;
  }

  // If the hook implementation does not exist, check whether it lives in an
  // optional include file registered via hook_hook_info().
  $hook_info = $this
    ->getHookInfo();
  if (isset($hook_info[$hook]['group'])) {
    $this
      ->loadInclude($module, 'inc', $module . '.' . $hook_info[$hook]['group']);
    if (function_exists($function)) {
      return TRUE;
    }
  }
  return FALSE;
}