You are here

function webform_share_update_node in Webform share 6

This resets the node webform array and resaves the node. The Webform module does the rest.

2 calls to webform_share_update_node()
webform_share_components_update_form_submit in ./webform_share.module
Submit callback to update the node.
webform_share_nodeapi in ./webform_share.module
Implements hook_nodeapi(). Sets the default components on a webbform node.

File

./webform_share.module, line 166
Module to handle importing and exporting of webforms, as well as adding the ability to set content type defaults.

Code

function webform_share_update_node($node, $webform = array(), $components_only = 1) {
  if ($components_only) {
    $node->webform['components'] = $webform['components'];
  }
  else {
    $node->webform = $webform;
    $node->webform['nid'] = $node->nid;
  }
  $node->webform['components'] = array_filter((array) $node->webform['components']);
  foreach ($node->webform['components'] as $index => $component) {
    $node->webform['components'][$index]['nid'] = $node->nid;
  }
  node_save($node);
}