You are here

function Utils::wf_crm_name_field_exists in Webform CiviCRM Integration 8.5

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

Overrides UtilsInterface::wf_crm_name_field_exists

File

src/Utils.php, line 804
Webform CiviCRM module's common utility functions.

Class

Utils

Namespace

Drupal\webform_civicrm

Code

function wf_crm_name_field_exists($enabled, $c, $contact_type) {
  foreach ($this
    ->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;
}