module_invoke_all

includes/module.inc, line 399

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

▾ 34 functions call module_invoke_all()

comment_render in modules/comment/comment.module
Renders comment(s).
drupal_cron_run in includes/common.inc
Executes a cron run when called
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.
drupal_retrieve_form in includes/form.inc
Retrieves the structured array that defines a given form.
file_download in includes/file.inc
node_access_acquire_grants in modules/node/node.module
This function will call module invoke to get a list of grants and then write them to the database. It is called at node save, and should be called by modules whenever something other than a node_save causes the permissions on a node to change.
node_access_grants in modules/node/node.module
Fetch an array of permission IDs granted to the given user ID.
node_admin_nodes in modules/node/node.module
node_admin_nodes_submit in modules/node/node.module
Submit the node administration update form.
node_type_delete in modules/node/node.module
Deletes a node type from the database.
node_type_reset in modules/node/content_types.inc
Resets all of the relevant fields of a module-defined node type to their default values.
node_type_save in modules/node/node.module
Saves a node type to the database.
node_view in modules/node/node.module
Generate a display of the given node.
poll_view in modules/poll/poll.module
Implementation of hook_view().
search_admin_settings in modules/search/search.module
Menu callback; displays the search module settings page.
search_wipe in modules/search/search.module
Wipes a part of or the entire search index.
system_status in modules/system/system.module
Menu callback: displays the site status report. Can also be used as a pure check.
taxonomy_del_term in modules/taxonomy/taxonomy.module
Delete a term.
taxonomy_del_vocabulary in modules/taxonomy/taxonomy.module
Delete a vocabulary.
taxonomy_save_term in modules/taxonomy/taxonomy.module
Helper function for taxonomy_form_term_submit().
taxonomy_save_vocabulary in modules/taxonomy/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/comment.module
theme_comment_thread_expanded in modules/comment/comment.module
user_admin_account in modules/user/user.module
user_admin_account_submit in modules/user/user.module
Submit the user administration update form.
user_delete in modules/user/user.module
Delete a user.
user_logout in modules/user/user.module
Menu callback; logs the current user out, and redirects to the home page.
_drupal_bootstrap_full in includes/common.inc
_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.
_node_types_build in modules/node/node.module
Builds and returns the list of available node types.
_ping_notify in modules/ping/ping.module
Call hook_ping() in all modules to notify remote sites that there is new content at this one.

Code

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

  return $return;
}
?>
 
 

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.