You are here

function webform_civicrm_webform_component_presave in Webform CiviCRM Integration 7.5

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

Implements hook_webform_component_presave(). Alter form keys when cloning a contact.

File

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

Code

function webform_civicrm_webform_component_presave(&$component) {
  if ($c = wf_crm_contact_clone_storage()) {
    $component['form_key'] = str_replace($c['old'], $c['new'], $component['form_key']);
    if ($component['type'] == 'civicrm_contact') {

      // Only contact 1 can be the current user
      if (wf_crm_aval($component, 'extra:default') == 'user') {
        unset($component['extra']['default']);
      }
    }
  }
}