You are here

private function WebformCivicrmPostProcess::getExistingContactIds in Webform CiviCRM Integration 8.5

Fetch contact ids from "existing contact" fields

1 call to WebformCivicrmPostProcess::getExistingContactIds()
WebformCivicrmPostProcess::preSave in src/WebformCivicrmPostProcess.php
Process webform submission when it is about to be saved. Called by the following hook:

File

src/WebformCivicrmPostProcess.php, line 599
Front-end form validation and post-processing.

Class

WebformCivicrmPostProcess

Namespace

Drupal\webform_civicrm

Code

private function getExistingContactIds() {
  foreach ($this->enabled as $field_key => $fid) {
    if (substr($field_key, -8) === 'existing') {
      list(, $c, ) = explode('_', $field_key, 3);
      $cid = wf_crm_aval($this
        ->submissionValue($fid), 0);
      $this->ent['contact'][$c]['id'] = $this
        ->verifyExistingContact($cid, $field_key);
      if ($this->ent['contact'][$c]['id']) {
        $this->existing_contacts[$c] = $cid;
      }
    }
  }
}