function node_test_node_insert

Implements hook_node_insert().

This tests saving a node on node insert.

See also

\Drupal\node\Tests\NodeSaveTest::testNodeSaveOnInsert()

File

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

Code

function node_test_node_insert(Node $node) {

  // Set the node title to the node ID and save.
  if ($node->title == 'new') {
    $node->title = 'Node ' . $node->nid;
    node_save($node);
  }
}