Commit f18a0861 authored by Cottser's avatar Cottser Committed by Placinta
Browse files

Issue #2283681 by Cottser | sylvain lavielle: Added hook before saving the converted node.

parent 5a3e9365
......@@ -139,4 +139,17 @@ function hook_node_convert_change($data, $op) {
}
}
}
}
\ No newline at end of file
}
/**
* Allow modifying a node during conversion but before the final save.
*
* @param stdClass $node
* The node object.
* @param array $hook_options
* Additional options passed to node_convert_node_convert().
*/
function hook_node_convert_presave($node, $hook_options = array()) {
// Set the author to user 1.
$node->uid = 1;
}
......@@ -75,6 +75,7 @@ function node_convert_node_convert($nid, $destination_node_type, $source_fields,
$converted_node = node_load($nid, NULL, TRUE);
$converted_node->type = $destination_node_type;
try {
module_invoke_all('node_convert_presave', $converted_node, $hook_options);
node_save($converted_node);
if (module_exists('rules')) {
......@@ -430,4 +431,4 @@ function node_convert_format_field_value_helper($field_values, $options = array(
}
$output .= $final_label . implode(', ', $items);
return $output;
}
\ No newline at end of file
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment