function pardot_webform_submit in Pardot Integration 7
Same name and namespace in other branches
- 6 pardot.module \pardot_webform_submit()
- 7.2 pardot_webform/pardot_webform.module \pardot_webform_submit()
Form submission handler for pardot_form_alter().
Stores submissions for Pardot.
1 string reference to 'pardot_webform_submit'
- pardot_form_alter in ./
pardot.module - Implements hook_form_alter().
File
- ./
pardot.module, line 294 - Pardot integration module.
Code
function pardot_webform_submit($form, &$form_state) {
$values = array();
// Browser headers!
$values['user_headers'] = _pardot_get_user_headers();
// Collapse form values so they make more sense to Pardot.
$values['post_fields'] = _pardot_form_collapse($form, $form_state);
// Save the values and essential information to the database.
$submission = new stdClass();
$submission->form_nid = $form['#node']->nid;
$submission->data = $values;
pardot_submission_save($submission);
if (!$submission->sid) {
$message = 'Unable to save submitted entry. <pre>!data</pre>';
$vars = array(
'!data' => var_export($submission, TRUE),
);
watchdog('pardot', $message, $vars, WATCHDOG_NOTICE);
}
else {
$_SESSION['pardot_submission'] = $submission->sid;
}
}