You are here

function context_node_node_insert in Context Node 7

Implements hook_node_insert()

File

./context_node.module, line 189

Code

function context_node_node_insert($node) {
  $option = variable_get("context_node_default_" . $node->type, '');
  if ($option == "none" || empty($option)) {
    return;
  }
  else {
    if (empty($node->context)) {
      $node->context = $option;
    }
    db_insert('context_node')
      ->fields(array(
      'nid' => $node->nid,
      'vid' => $node->vid,
      'context' => $node->context,
    ))
      ->execute();
  }
}