function pardot_webform_submit in Pardot Integration 6
Same name and namespace in other branches
- 7.2 pardot_webform/pardot_webform.module \pardot_webform_submit()
- 7 pardot.module \pardot_webform_submit()
Submit handler added to webforms to store submissions for pardot.
1 string reference to 'pardot_webform_submit'
- pardot_form_alter in ./
pardot.module - Implementation of hook_form_alter().
File
- ./
pardot.module, line 260 - 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;
}
}