function sheetnode_update in Sheetnode 7
Same name and namespace in other branches
- 5 sheetnode.module \sheetnode_update()
- 6 sheetnode.module \sheetnode_update()
- 7.2 sheetnode.module \sheetnode_update()
Implements hook_update().
File
- ./
sheetnode.module, line 278 - Module file for the sheetnode module.
Code
function sheetnode_update($node) {
if (!empty($node->sheetnode['value'])) {
_sheetnode_save($node->nid, $node->vid, $node->sheetnode['value']);
}
elseif (!empty($node->revision)) {
// Reverting a revision.
$value = db_query("SELECT value FROM {sheetnode} WHERE vid = :old", array(
':old' => $node->old_vid,
))
->fetchField();
db_insert('sheetnode')
->fields(array(
'vid' => $node->vid,
'nid' => $node->nid,
'value' => $value,
))
->execute();
}
if (!empty($node->sheetnode['template']) && user_access('create sheetnode template')) {
_sheetnode_template_save($node->vid, $node->sheetnode['template'], $node->sheetnode['value']);
}
}