You are here

function wf_crm_name_field_exists in Webform CiviCRM Integration 7.3

Same name and namespace in other branches
  1. 7.5 includes/utils.inc \wf_crm_name_field_exists()
  2. 7.4 includes/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_component_insert in ./webform_civicrm_admin.inc
Add a CiviCRM field to a webform
wf_crm_update_existing_component in ./contact_component.inc
Update existing component if other fields have been added or removed
_wf_crm_participant_validate in ./webform_civicrm_forms.inc
Validation callback for event registrations.

File

./webform_civicrm_utils.inc, line 1324
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;
}