Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function hook_update

Respond to updates to a node.

This is a node-type-specific hook, which is invoked only for the node type being affected. See Node API hooks for more information.

Use hook_node_update() to respond to node update of all node types.

This hook is invoked from node_save() after the node is updated in the node table in the database, before field_attach_update() is called, and before hook_node_update() is invoked.

Parameters

$node: The node that is being updated.

Related topics

Node API Hooks
Functions to define and modify content types.
Hooks
Allow modules to interact with the Drupal core.
48 functions implement hook_update()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

book_form_update in modules/book/book.module
Renders a new parent page select element when the book selection changes.
book_node_type_update in modules/book/book.module
Implements hook_node_type_update().
book_node_update in modules/book/book.module
Implements hook_node_update().
comment_node_type_update in modules/comment/comment.module
Implements hook_node_type_update().
dashboard_update in modules/dashboard/dashboard.module
Sets the new weight of each region according to the drag-and-drop order.

... See full list

File

modules/node/node.api.php, line 1236

Code

function hook_update ($node) {
 db_update ('mytable')->fields (array(
 'extra' => $node->extra,
 ))
 ->condition ('nid', $node->nid)
 ->execute ();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.