module_hook_info
- Versions
- 7
module_hook_info()
Retrieve a list of what hooks are explicitly declared.
Related topics
Code
includes/module.inc, line 524
<?php
function module_hook_info() {
$hook_info = &drupal_static(__FUNCTION__, array());
if (empty($hook_info)) {
$cache = cache_get('hook_info', 'cache_bootstrap');
if ($cache === FALSE) {
// Rebuild the cache and save it.
// We can't use module_invoke_all() here or it would cause an infinite
// loop.
foreach (module_list() as $module) {
$function = $module . '_hook_info';
if (function_exists($function)) {
$result = $function();
if (isset($result) && is_array($result)) {
$hook_info = array_merge_recursive($hook_info, $result);
}
}
}
// We can't use drupal_alter() for the same reason as above.
foreach (module_list() as $module) {
$function = $module . '_hook_info_alter';
if (function_exists($function)) {
$function($hook_info);
}
}
cache_set('hook_info', $hook_info, 'cache_bootstrap');
}
else {
$hook_info = $cache->data;
}
}
return $hook_info;
}
?>Login or register to post comments 