1 node_hooks_example.module node_hooks_example_node_insert($node)

Implements hook_node_insert().

As a new node is being inserted into the database, we need to do our own database inserts.

Related topics

File

modules/examples/node_hooks_example/node_hooks_example.module, line 155
Hook implementations for the Node Hooks Example module.

Code

function node_hooks_example_node_insert($node) {
  if (config_get('node_hooks_example.settings', 'node_hooks_example_node_type_' . $node->type)) {
    db_insert('node_hooks_example')
      ->fields(array('nid' => $node->nid, 'vid' => $node->vid, 'rating' => $node->node_hooks_example_rating))
      ->execute();
  }
}