1 module.inc module_invoke($module, $hook)

Invokes a hook in a particular module.

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


$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

mixed|NULL: The return value of the hook implementation. NULL if the module does not implement the given hook.

See also


Related topics


core/includes/module.inc, line 937
API for loading and interacting with Backdrop modules.


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);

  return NULL;