Drupal Hook Mechanism

May 19, 2009 by hejian

Implement a hook
A hook is a PHP function that is named foo_bar(), where “foo” is the name of the module and “bar” is the name of the hook.

Call hooks
Determine whether a module implements a hook:

module_hook($module, $hook)

Determine which modules are implementing a hook:

module_implements($hook, $sort = FALSE)

Invoke a hook in a particular module:

module_invoke($module, $hook)

Invoke a hook in all enabled modules that implement it:

module_invoke_all($hook)

Invoke a hook_nodeapi() operation in all modules:

node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL)

Leave a Reply

You must be logged in to post a comment.

Wordpress template made by HeJian