You are here

function pardot_form_alter in Pardot Integration 7

Same name and namespace in other branches
  1. 6 pardot.module \pardot_form_alter()

Implements hook_form_alter().

See also

pardot_webform_submit()

File

./pardot.module, line 174
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';
}