module_invoke_all

Versions
4.6 – 7
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 functions call module_invoke_all()

comment_moderate in modules/comment.module
comment_post in modules/comment.module
comment_preview in modules/comment.module
comment_render in modules/comment.module
comment_save in modules/comment.module
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.
module_init in includes/module.inc
Initialize all modules.
node_access_grants in modules/node.module
Fetch an array of permission IDs granted to the given user ID.
node_add in modules/node.module
Present a node submission form or a set of links to such forms.
node_help in modules/node.module
Implementation of hook_help().
node_view in modules/node.module
Generate a display of the given node.
poll_view in modules/poll.module
Implementation of hook_view().
search_wipe in modules/search.module
Wipes a part of or the entire search index.
taxonomy_del_term in modules/taxonomy.module
taxonomy_del_vocabulary in modules/taxonomy.module
taxonomy_save_term in modules/taxonomy.module
taxonomy_save_vocabulary in modules/taxonomy.module
theme_closure in includes/theme.inc
Execute hook_footer() which is run at the end of the page right before the close of the body tag.
theme_comment_flat_expanded in modules/comment.module
theme_comment_thread_max in modules/comment.module
theme_onload_attribute in includes/theme.inc
Call hook_onload() in all modules to enable modules to insert JavaScript that will get run once the page has been loaded by the browser.
user_edit in modules/user.module
user_logout in modules/user.module
Menu callback; logs the current user out, and redirects to the home page.
_comment_delete_thread in modules/comment.module
_menu_append_contextual_items in includes/menu.inc
Account for menu items that are only defined at certain paths, so will not be cached.
_menu_build in includes/menu.inc
Build the menu by querying both modules and the database.
_ping_notify in modules/ping.module
Call hook_ping() in all modules to notify remote sites that there is new content at this one.

Code

includes/module.inc, line 195

<?php
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 (is_array($result)) {
      $return = array_merge($return, $result);
    }
    else if (isset($result)) {
      $return[] = $result;
    }
  }

  return $return;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.