1 node_test.module node_test_node_insert($node)

Implements hook_node_insert().

This tests saving a node on node insert.

See also

NodeSaveTest::testNodeSaveOnInsert()

File

core/modules/node/tests/node_test/node_test.module, line 173
A dummy module for testing node related hooks.

Code

function node_test_node_insert($node) {
  // Set the node title to the node ID and save.
  if ($node->title == 'new') {
    $node->title = 'Node ' . $node->nid;
    // Remove the is_new flag, so that the node is updated and not inserted
    // again.
    unset($node->is_new);
    node_save($node);
  }
}