You are here

function Utils::wf_crm_required_contact_fields in Webform CiviCRM Integration 8.5

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

Parameters

string $contact_type:

Return value

array of fields

Overrides UtilsInterface::wf_crm_required_contact_fields

1 call to Utils::wf_crm_required_contact_fields()
Utils::wf_crm_name_field_exists in src/Utils.php
Check if a name or email field exists for this contact. This determines whether a new contact can be created on the webform.

File

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

Class

Utils

Namespace

Drupal\webform_civicrm

Code

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