1. 1.12.x modules/node/node.api.php node_api_hooks
  2. 1.10.x modules/node/node.api.php node_api_hooks
  3. 1.11.x modules/node/node.api.php node_api_hooks
  4. 1.7.x modules/node/node.api.php node_api_hooks

Functions to define and modify content types.

Each content type is maintained by a primary module, which is either node.module (for content types created in the user interface) or the module that provides a node type in its default config directory. Modules that provide a content type should explicitly set the "module" key in their config file.

During node operations (create, update, view, delete, etc.), there are several sets of hooks that get invoked to allow modules to modify the base node operation:

  • Node-type-specific hooks: When defining a node type, hook_node_info() returns a 'base' component. Node-type-specific hooks are named base_hookname() instead of mymodule_hookname() (in a module called 'mymodule' for example). Only the node type's corresponding implementation is invoked. For example, book_node_info() in book.module defines the base for the 'book' node type as 'book'. So when a book node is created, hook_insert() is invoked on book_insert() only. Hooks that are node-type-specific are noted below.
  • All-module hooks: This set of hooks is invoked on all implementing modules, to allow other modules to modify what the primary node module is doing. For example, hook_node_insert() is invoked on all modules when creating a book node.
  • Field hooks: Hooks related to the fields attached to the node. These are invoked from the field operations functions described below, and can be either field-type-specific or all-module hooks.
  • Entity hooks: Generic hooks for "entity" operations. These are always invoked on all modules.

Here is a list of the node and entity hooks that are invoked, field operations, and other steps that take place during node operations:

File

modules/node/node.api.php, line 7
Hooks provided by the Node module.

Functions

Namesort descending Location Description
hook_delete modules/node/node.api.php Respond to node deletion.
hook_form modules/node/node.api.php Display a node editing form.
hook_insert modules/node/node.api.php Respond to creation of a new node.
hook_load modules/node/node.api.php Act on nodes being loaded from the database.
hook_node_delete modules/node/node.api.php Respond to node deletion.
hook_node_insert modules/node/node.api.php Respond to creation of a new node.
hook_node_load modules/node/node.api.php Act on arbitrary nodes being loaded from the database.
hook_node_predelete modules/node/node.api.php Act before node deletion.
hook_node_prepare modules/node/node.api.php Act on a node object about to be shown on the add/edit form.
hook_node_presave modules/node/node.api.php Act on a node being inserted or updated.
hook_node_revision_delete modules/node/node.api.php Respond to deletion of a node revision.
hook_node_search_result modules/node/node.api.php Act on a node being displayed as a search result.
hook_node_submit modules/node/node.api.php Act on a node after validated form values have been copied to it.
hook_node_update modules/node/node.api.php Respond to updates to a node.
hook_node_update_index modules/node/node.api.php Act on a node being indexed for searching.
hook_node_validate modules/node/node.api.php Perform node validation before a node is created or updated.
hook_node_view modules/node/node.api.php Act on a node that is being assembled before rendering.
hook_node_view_alter modules/node/node.api.php Alter the results of node_view().
hook_prepare modules/node/node.api.php Act on a node object about to be shown on the add/edit form.
hook_ranking modules/node/node.api.php Provide additional methods of scoring for core search results for nodes.
hook_update modules/node/node.api.php Respond to updates to a node.
hook_validate modules/node/node.api.php Perform node validation before a node is created or updated.
hook_view modules/node/node.api.php Display a node.