You are here

function CivicrmContact::wf_crm_results_display_options in Webform CiviCRM Integration 8.5

Returns a list of fields that can be shown in an "Existing Contact" field display In the future we could use api.getfields for this, but that also returns a lot of stuff we don't want

Return value

array

1 call to CivicrmContact::wf_crm_results_display_options()
CivicrmContact::form in src/Plugin/WebformElement/CivicrmContact.php

File

src/Plugin/WebformElement/CivicrmContact.php, line 476

Class

CivicrmContact
Provides a 'textfield' element.

Namespace

Drupal\webform_civicrm\Plugin\WebformElement

Code

function wf_crm_results_display_options($contact_type) {
  $options = [
    'display_name' => t("Display Name"),
    'sort_name' => t("Sort Name"),
  ];
  if ($contact_type == 'individual') {
    $options += [
      'first_name' => t("First Name"),
      'middle_name' => t("Middle Name"),
      'last_name' => t("Last Name"),
      'current_employer' => t("Current Employer"),
      'job_title' => t("Job Title"),
    ];
  }
  else {
    $options[$contact_type . '_name'] = $contact_type == 'organization' ? t("Organization Name") : t("Household Name");
  }
  $options += [
    'nick_name' => t("Nick Name"),
    'id' => t("Contact ID"),
    'external_identifier' => t("External ID"),
    'source' => t("Source"),
    'email' => t("Email"),
    'city' => t("City"),
    'county' => t("District/County"),
    'state_province' => t("State/Province"),
    'country' => t("Country"),
    'postal_code' => t("Postal Code"),
    'phone' => t("Phone"),
  ];
  return $options;
}