function pardot_form_alter in Pardot Integration 6
Same name and namespace in other branches
- 7 pardot.module \pardot_form_alter()
 
Implementation of hook_form_alter().
File
- ./
pardot.module, line 143  - ParDot integration module.
 
Code
function pardot_form_alter(&$form, $form_state, $form_id) {
  if (strpos($form_id, 'webform_client_form') !== 0) {
    return;
  }
  // Modify all webforms to use this output thingy
  // Load the form specific settings
  $nid = $form['details']['nid']['#value'];
  if (empty($nid)) {
    return;
  }
  $form_settings = pardot_webform_load($nid);
  // Check to see if the form exists
  if (empty($form_settings) || !$form_settings->is_active) {
    return;
  }
  $form['#submit'] = is_array($form['#submit']) ? $form['#submit'] : array(
    'webform_client_form_submit ',
  );
  $form['#submit'][] = 'pardot_webform_submit';
}