Posts Tagged ‘Hook’
Drupal Hook Mechanism
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)
Drupal Hooks for Node Form
These are the hooks for implement a Drupal Node Form:
hook_form(&$node, &$param)
Display a node editing form.
hook_insert($node)
Respond to node insertion.
hook_load($node)
Load node-type-specific information.
hook_submit(&$node)
Called after validation has succeeded and before insert/update.
hook_update($node)
Respond to node updating.
hook_validate($node)
Verify a node editing form.