You are here

function wf_crm_required_contact_fields in Webform CiviCRM Integration 7.3

Same name and namespace in other branches
  1. 7.5 includes/utils.inc \wf_crm_required_contact_fields()
  2. 7.4 includes/utils.inc \wf_crm_required_contact_fields()

At least one of these fields is required to create a contact

Parameters

$contact_type: string: contact type

Return value

array of fields

2 calls to wf_crm_required_contact_fields()
wf_crm_name_field_exists in ./webform_civicrm_utils.inc
Check if a name or email field exists for this contact. This determines whether a new contact can be created on the webform.
wf_crm_process_submission in ./webform_civicrm_forms.inc
Webform submission handler Create/update CiviCRM contacts and related data Called by presave, insert and update webform hooks

File

./webform_civicrm_utils.inc, line 1342
Webform CiviCRM module's common utility functions.

Code

function wf_crm_required_contact_fields($contact_type) {
  if ($contact_type == 'individual') {
    return array(
      array(
        'table' => 'email',
        'name' => 'email',
      ),
      array(
        'table' => 'contact',
        'name' => 'first_name',
      ),
      array(
        'table' => 'contact',
        'name' => 'last_name',
      ),
      array(
        'table' => 'contact',
        'name' => 'nick_name',
      ),
    );
  }
  return array(
    array(
      'table' => 'contact',
      'name' => $contact_type . '_name',
    ),
  );
}