hook_insert
function hook_insert
hook_insert($node)
Respond to creation of a new 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_insert() to respond to node insertion of all node types.
This hook is invoked from node_save() after the node is inserted into the node table in the database, before field_attach_insert() is called, and before hook_node_insert() is invoked.
Parameters
$node: The node that is being created.
Related topics
File
- modules/node/node.api.php, line 1172
- Hooks provided by the Node module.
Code
function hook_insert($node) { db_insert('mytable') ->fields(array( 'nid' => $node->nid, 'extra' => $node->extra, )) ->execute(); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_insert/7.x