You are here

function wf_crm_name_field_exists in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/utils.inc \wf_crm_name_field_exists()
  2. 7.3 webform_civicrm_utils.inc \wf_crm_name_field_exists()

Check if a name or email field exists for this contact. This determines whether a new contact can be created on the webform.

Parameters

$enabled: Array of enabled fields

$c: Contact #

$contact_type: Contact type

Return value

int

3 calls to wf_crm_name_field_exists()
wf_crm_admin_form::insertComponent in includes/wf_crm_admin_form.inc
Add a CiviCRM field to a webform
wf_crm_update_existing_component in includes/contact_component.inc
Update existing component if other fields have been added or removed
wf_crm_webform_postprocess::loadMultiPageData in includes/wf_crm_webform_postprocess.inc
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

File

includes/utils.inc, line 1644
Webform CiviCRM module's common utility functions.

Code

function wf_crm_name_field_exists($enabled, $c, $contact_type) {
  foreach (wf_crm_required_contact_fields($contact_type) as $f) {
    $fid = 'civicrm_' . $c . '_contact_1_' . $f['table'] . '_' . $f['name'];
    if (!empty($enabled[$fid])) {
      return 1;
    }
  }
  return 0;
}