You are here

function webform_insert in Webform 5.2

Same name and namespace in other branches
  1. 5 webform.module \webform_insert()
  2. 6.2 webform.module \webform_insert()

Implementation of hook_insert().

1 call to webform_insert()
webform_update in ./webform.module
Implementation of hook_update().

File

./webform.module, line 323

Code

function webform_insert($node) {
  include_once drupal_get_path('module', 'webform') . '/webform_components.inc';

  // Insert the Webform.
  db_query("INSERT INTO {webform} (nid, confirmation, teaser, submit_text, submit_limit, submit_interval, email, email_from_name, email_from_address, email_subject, additional_validate, additional_submit) VALUES (%d, '%s', %d, '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s')", $node->nid, $node->webform['confirmation'], $node->webform['teaser'], $node->webform['submit_text'], $node->webform['submit_limit'], $node->webform['submit_interval'], $node->webform['email'], $node->webform['email_from_name'], $node->webform['email_from_address'], $node->webform['email_subject'], $node->webform['additional_validate'], $node->webform['additional_submit']);

  // Insert the components into the database. Used with clone.module.
  if (isset($node->webform['components']) && !empty($node->webform['components'])) {
    foreach ($node->webform['components'] as $cid => $component) {
      $component['nid'] = $node->nid;
      webform_component_insert($component);
    }
  }

  // Set the per-role submission access control.
  foreach ($node->webform['roles'] as $rid) {
    db_query('INSERT INTO {webform_roles} (nid, rid) VALUES (%d, %d)', $node->nid, $rid);
  }
}