private function wf_crm_admin_form::rebuildForm in Webform CiviCRM Integration 7.4
Same name and namespace in other branches
- 7.5 includes/wf_crm_admin_form.inc \wf_crm_admin_form::rebuildForm()
On rebuilding the form
1 call to wf_crm_admin_form::rebuildForm()
- wf_crm_admin_form::buildForm in includes/
wf_crm_admin_form.inc - Build admin form for civicrm tab of a webform
File
- includes/
wf_crm_admin_form.inc, line 113 - Webform CiviCRM module's admin form.
Class
- wf_crm_admin_form
- @file Webform CiviCRM module's admin form.
Code
private function rebuildForm() {
$this->settings = wf_crm_aval($this->form_state['storage'], 'vals', $this->form_state['values']);
$this
->rebuildData();
// Hack for nicer UX: pre-check phone, email, etc when user increments them
if (!empty($_POST['_triggering_element_name'])) {
$defaults = array(
'phone' => 'phone',
'email' => 'email',
'website' => 'url',
'im' => 'name',
'address' => array(
'street_address',
'city',
'state_province_id',
'postal_code',
),
);
foreach ($defaults as $ent => $fields) {
if (strpos($_POST['_triggering_element_name'], "_number_of_{$ent}")) {
list(, $c) = explode('_', $_POST['_triggering_element_name']);
for ($n = 1; $n <= $this->data['contact'][$c]["number_of_{$ent}"]; ++$n) {
foreach ((array) $fields as $field) {
$this->settings["civicrm_{$c}_contact_{$n}_{$ent}_{$field}"] = 1;
}
}
}
}
}
unset($this->form_state['storage']['vals']);
}