I currently have an "Event" content type with a webform attached to each event. The webforms use the conditional confirmation message module to display different confirmation messages depending on the input to the form. I'm using the node clone module to duplicate events and everything works well expect that the conditional confirmation messages are not being duplicated. What should I do so that every part of the event node (including the conditional confirmation messages) is duplicated?
-
The conditional confirmation messages seems to be not part of the node (field or node object property) so It won't be considered part of the node and not duplicated– Mohammed GommaCommented May 31, 2015 at 9:42
-
Would it be possible in any way to achieve the desired behavior?– shoopdelangCommented May 31, 2015 at 15:15
Add a comment
|
1 Answer
The node clone module gives you the tools to make this happen. You can have a custom module make use of hook_node_clone_alter
then use the Webform Conditional Confirmation module's functions to load & copy the original messages, store them temporarily, then save them upon saving the newly cloned node.
Something like this...
function MYMODULE_clone_node_alter(&$node, $context) {
$messages = webform_conditional_confirmation_message_load($node->clone_from_original_nid);
foreach($messages as $msg_id => $message) {
//@TODO: Store in some temporary spot until cloned node is saved
}
}
function MYMODULE_node_update($node) {
//@TODO: Retrieve messages from temp location and place into $messages
foreach($messages as $msg_id => $message) {
$message->nid = $node->nid;
webform_conditional_confirmation_message_save($message);
}
}