Same name and namespace in other branches
  1. 4.6.x includes/module.inc \module_hook()
  2. 4.7.x includes/module.inc \module_hook()
  3. 6.x includes/module.inc \module_hook()
  4. 7.x includes/module.inc \module_hook()

Determine whether a module implements a hook.

Parameters

$module: The name of the module (without the .module extension).

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

Return value

TRUE if the module is both installed and enabled, and the hook is implemented in that module.

Related topics

1 call to module_hook()
node_hook in modules/node/node.module
Determine whether a node hook exists.

File

includes/module.inc, line 321
API for loading and interacting with Drupal modules.

Code

function module_hook($module, $hook) {
  return function_exists($module . '_' . $hook);
}