Same name and namespace in other branches
  1. 4.6.x includes/module.inc \module_invoke()
  2. 4.7.x includes/module.inc \module_invoke()
  3. 5.x includes/module.inc \module_invoke()
  4. 6.x includes/module.inc \module_invoke()

Invokes a hook in a particular module.

All arguments are passed by value. Use drupal_alter() if you need to pass arguments by reference.

Parameters

$module: The name of the module (without the .module extension).

$hook: The name of the hook to invoke.

...: Arguments to pass to the hook implementation.

Return value

The return value of the hook implementation.

See also

drupal_alter()

Related topics

65 calls to module_invoke()
aggregator_form_aggregator_admin_form_alter in modules/aggregator/aggregator.processor.inc
Implements hook_form_aggregator_admin_form_alter().
aggregator_refresh in modules/aggregator/aggregator.module
Checks a news feed for new items.
block_admin_configure in modules/block/block.admin.inc
Form constructor for the block configuration form.
block_admin_configure_submit in modules/block/block.admin.inc
Form submission handler for block_admin_configure().
block_form_user_profile_form_alter in modules/block/block.module
Implements hook_form_FORM_ID_alter() for user_profile_form().

... See full list

File

includes/module.inc, line 930
API for loading and interacting with Drupal modules.

Code

function module_invoke($module, $hook) {
  $args = func_get_args();

  // Remove $module and $hook from the arguments.
  unset($args[0], $args[1]);
  if (module_hook($module, $hook)) {
    return call_user_func_array($module . '_' . $hook, $args);
  }
}