hook_node_insert

Versions
7
hook_node_insert($node)

Respond to creation of a new node.

This hook is invoked from node_save() after the node is inserted into the node table in the database, after the type-specific hook_insert() is invoked, and after field_attach_insert() is called.

Parameters

$node The node that is being created.

Related topics

Code

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

<?php
function hook_node_insert($node) {
  db_insert('mytable')
    ->fields(array(
      'nid' => $node->nid,
      'extra' => $node->extra,
    ))
    ->execute();
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.