function hook_update

Respond to updates to a node.

This hook is invoked only on the module that defines the node's content type (use hook_node_update() to act on all node updates).

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

\Drupal\Core\Entity\EntityInterface $node: The node that is being updated.

Related topics

50 functions implement hook_update()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

book_form_update in drupal/core/modules/book/book.module
Renders a new parent page select element when the book selection changes.
book_node_type_update in drupal/core/modules/book/book.module
Implements hook_node_type_update().
book_node_update in drupal/core/modules/book/book.module
Implements hook_node_update().
comment_node_type_update in drupal/core/modules/comment/comment.module
Implements hook_node_type_update().
config_test_config_test_update in drupal/core/modules/config/tests/config_test/config_test.hooks.inc
Implements hook_config_test_update().

... See full list

File

drupal/core/modules/node/node.api.php, line 1213
Hooks provided by the Node module.

Code

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