function clone_node_save in Node clone 7
Same name and namespace in other branches
- 6 clone.pages.inc \clone_node_save()
Clones a node by directly saving it.
3 calls to clone_node_save()
- clone_action_node_clone in ./
clone.rules.inc - Action callback for cloning a node.
- clone_node_check in ./
clone.pages.inc - Menu callback: prompt the user to confirm the operation
- clone_node_confirm_submit in ./
clone.pages.inc - Handle confirm form submission
File
- ./
clone.pages.inc, line 192 - Additional functions for Node_Clone module.
Code
function clone_node_save($nid, $account = NULL) {
if (is_numeric($nid)) {
$original_node = node_load($nid);
if (isset($original_node->nid) && clone_is_permitted($original_node->type)) {
$node = _clone_node_prepare($original_node, TRUE, $account);
// Let other modules do special fixing up.
$context = array(
'method' => 'save-edit',
'original_node' => $original_node,
);
drupal_alter('clone_node', $node, $context);
node_save($node);
if (module_exists('rules')) {
rules_invoke_event('clone_node', $node, $original_node);
}
return $node->nid;
}
}
}