function module_invoke_all in Drupal 4
Same name and namespace in other branches
- 5 includes/module.inc \module_invoke_all()
- 6 includes/module.inc \module_invoke_all()
- 7 includes/module.inc \module_invoke_all()
Invoke a hook in all enabled modules that implement it.
Parameters
$hook: The name of the hook to invoke.
...: Arguments to pass to the hook.
Return value
An array of return values of the hook implementations. If modules return arrays from their implementations, those are merged into one array.
Related topics
28 calls to module_invoke_all()
- comment_render in modules/
comment.module - cron.php in ./
cron.php - drupal_goto in includes/
common.inc - Send the user to a different Drupal page.
- drupal_page_footer in includes/
common.inc - Perform end-of-request tasks.
- file_download in includes/
file.inc - Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If a module returns -1 drupal_access_denied() will be returned. If one or more modules returned headers the download…
File
- includes/
module.inc, line 196 - API for loading and interacting with Drupal modules.
Code
function module_invoke_all() {
$args = func_get_args();
$hook = array_shift($args);
$return = array();
foreach (module_implements($hook) as $module) {
$function = $module . '_' . $hook;
$result = call_user_func_array($function, $args);
if (isset($result) && is_array($result)) {
$return = array_merge($return, $result);
}
else {
if (isset($result)) {
$return[] = $result;
}
}
}
return $return;
}