function draggableviews_handler_book::save in DraggableViews 6.3
Overrides draggableviews_handler::save
File
- modules/
draggableviews_book/ draggableviews_handler_book.inc, line 69 - The default implementation for draggableviews.
Class
Code
function save($nid, $value) {
// Load the noad and reset it if it's already cached.
$node = node_load($nid, NULL, TRUE);
switch ($this->type) {
case 'hierarchy':
if ($value == 0) {
// This is the simulated "first root item". Restore the actual value now.
$value = $this->root;
}
$node->book['plid'] = db_result(db_query("SELECT mlid FROM {book} WHERE nid = %d", $value));
break;
case 'order':
// The order value of the simulated "first root item" is 0. So the order value of
// the parent item + 1 (previous order value) must be added to each order value.
$node->book['weight'] = $value + ($this->root + 1);
break;
}
$node = node_submit($node);
node_save($node);
}