function skinr_hook in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr.module \skinr_hook()
Determine whether a module implements a hook.
Replacement for module_hook() that only invokes modules that implement the current version of Skinr API. It also supports $module.skinr.inc files in themes and custom paths.
Parameters
$module: The name of the module (without the .module extension).
$hook: The name of the hook (e.g. "skinr_skin_info" or "skinr_theme_hooks").
Return value
TRUE if the module is both installed and enabled, and the hook is implemented in that module.
3 calls to skinr_hook()
- skinr_get_group_info in ./
skinr.module - Retrieves all skin groups registered by modules and themes.
- skinr_get_skin_info in ./
skinr.module - Retrieves all skins registered by modules and themes.
- skinr_test_hook_dynamic_loading in tests/
skinr_test/ skinr_test.module - Page callback for 'hook dynamic loading' test.
File
- ./
skinr.module, line 380 - Handles core Skinr functionality.
Code
function skinr_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
// include file in a custom path.
$extensions = skinr_implements_api();
if (isset($extensions[$module])) {
$extension = $extensions[$module];
if (isset($extension['include file'])) {
// The module specified a custom path. module_hook() only auto-loads
// $module.skinr.inc in a module's root folder.
skinr_load_include($extension['include file']);
if (function_exists($module . '_' . $hook)) {
return TRUE;
}
}
else {
// Run through module_hook() to auto-load $module.skinr.inc from a
// non-custom path.
if (module_hook($module, $hook)) {
return TRUE;
}
}
}
return FALSE;
}