private function WebformCivicrmPostProcess::loadMultiPageData in Webform CiviCRM Integration 8.5
Load entire webform submission during validation, including contact ids and $this->data Used when validation for one page needs access to submitted values from other pages
1 call to WebformCivicrmPostProcess::loadMultiPageData()
- WebformCivicrmPostProcess::validate in src/
WebformCivicrmPostProcess.php - Called after a webform is submitted Or, for a multipage form, called after each page
File
- src/
WebformCivicrmPostProcess.php, line 554 - Front-end form validation and post-processing.
Class
Namespace
Drupal\webform_civicrmCode
private function loadMultiPageData() {
if (!$this->multiPageDataLoaded) {
$this->multiPageDataLoaded = TRUE;
/*
* This feels like an old/weird hack to bypass form API/webform funk in D7.
if (!empty($this->form_state['storage']['submitted']) && wf_crm_aval($this->form_state, 'storage:page_num', 1) > 1) {
$this->rawValues += $this->form_state['storage']['submitted'];
$this->crmValues = wf_crm_enabled_fields($this->node, $this->rawValues);
}
*/
// Check how many valid contacts we have
foreach ($this->data['contact'] as $c => $contact) {
// Check if we have a contact_id
$fid = "civicrm_{$c}_contact_1_contact_existing";
if ($this
->verifyExistingContact(wf_crm_aval($this->crmValues, $fid), $fid)) {
$this->existing_contacts[$c] = $this->crmValues[$fid];
}
elseif (\Drupal::service('webform_civicrm.utils')
->wf_crm_name_field_exists($this->crmValues, $c, $contact['contact'][1]['contact_type'])) {
$this->existing_contacts[$c] = 0;
}
}
// Fill data array with submitted form values
$this
->fillDataFromSubmission();
}
}