You are here

function internal_nodes_node_update in Internal Nodes 7

Implements hook_node_update().

File

./internal_nodes.module, line 417
Internal nodes

Code

function internal_nodes_node_update($node) {
  if (variable_get('internal_nodes_nodes_' . $node->type, 0)) {

    // If data exists
    if (db_select('internal_nodes', 'd')
      ->fields('d')
      ->condition('nid', $node->nid, '=')
      ->execute()
      ->fetchAssoc()) {
      db_update('internal_nodes')
        ->fields(array(
        'action' => $node->internal_nodes['action'],
        'url' => $node->internal_nodes['url'],
      ))
        ->condition('nid', $node->nid)
        ->execute();
    }
    else {

      // Cleaner than doing it again.
      internal_nodes_node_insert($node);
    }
  }
}