You are here

function webform_civicrm_form_alter in Webform CiviCRM Integration 7

Same name and namespace in other branches
  1. 8.5 webform_civicrm.module \webform_civicrm_form_alter()
  2. 6.2 webform_civicrm.module \webform_civicrm_form_alter()
  3. 6 webform_civicrm.module \webform_civicrm_form_alter()
  4. 7.5 webform_civicrm.module \webform_civicrm_form_alter()
  5. 7.2 webform_civicrm.module \webform_civicrm_form_alter()
  6. 7.3 webform_civicrm.module \webform_civicrm_form_alter()
  7. 7.4 webform_civicrm.module \webform_civicrm_form_alter()

Implements hook_form_alter().

File

./webform_civicrm.module, line 48
Webform CiviCRM Integration Module: Links webform submissions to contacts in a CiviCRM database. @author Coleman Watts

Code

function webform_civicrm_form_alter(&$form, $form_state, $form_id) {

  // Alter back-end webform component edit forms
  if ($form_id == 'webform_component_edit_form') {
    if (substr($form['form_key']['#default_value'], 0, 7) == 'civicrm') {
      module_load_include('inc', 'webform_civicrm', 'webform_civicrm_forms');
      _webform_civicrm_webform_component_form_alter($form);
    }
  }
  elseif (strpos($form_id, 'webform_client_form_') !== FALSE) {
    if (isset($form['#node']->webform_civicrm) && arg(2) != 'done' && arg(2) != 'webform') {
      module_load_include('inc', 'webform_civicrm', 'webform_civicrm_forms');
      _webform_civicrm_webform_frontend_form_alter($form);
    }
  }
}