Determines whether a module implements a hook.
$module: The name of the module (without the .module extension).
$hook: The name of the hook (e.g. "help" or "menu").
TRUE if the module is both installed and enabled, and the hook is implemented in that module.
function module_hook($module, $hook) {
$function = $module . '_' . $hook;
if (function_exists($function)) {
return TRUE;
}
// If the hook implementation does not exist, check whether it may live in an
// optional include file registered via hook_hook_info().
$hook_info = module_hook_info();
if (isset($hook_info[$hook]['group'])) {
module_load_include('inc', $module, $module . '.' . $hook_info[$hook]['group']);
if (function_exists($function)) {
return TRUE;
}
}
return FALSE;
}