You are here

function webform_template_node_insert in Webform Template 7

Same name and namespace in other branches
  1. 7.4 webform_template.module \webform_template_node_insert()

Implements hook_node_insert().

File

./webform_template.module, line 132

Code

function webform_template_node_insert($node) {
  if (isset($_SESSION['webform_template'])) {
    $template = node_load($_SESSION['webform_template']);
    $webform = $template->webform;
    $node->webform = $webform;
    $node->webform['nid'] = $node->nid;

    // Integration with other modules.
    if (module_exists('webform_validation')) {
      _webform_template_webform_validation_helper($node, $template);
    }

    // Allow other modules to modify the webform.
    module_invoke_all('webform_template_insert', $node, $template);

    // Clean up session.
    unset($_SESSION['webform_template']);
  }
}