You are here

function Utils::wf_crm_get_relationship_types in Webform CiviCRM Integration 8.5

Get relationship type data

Return value

array

Overrides UtilsInterface::wf_crm_get_relationship_types

1 call to Utils::wf_crm_get_relationship_types()
Utils::wf_crm_get_contact_relationship_types in src/Utils.php
Get valid relationship types for a given pair of contacts

File

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

Class

Utils

Namespace

Drupal\webform_civicrm

Code

function wf_crm_get_relationship_types() {
  static $types = [];
  if (!$types) {
    foreach ($this
      ->wf_crm_apivalues('relationship_type', 'get', [
      'is_active' => 1,
    ]) as $r) {
      $r['type_a'] = strtolower(wf_crm_aval($r, 'contact_type_a'));
      $r['type_b'] = strtolower(wf_crm_aval($r, 'contact_type_b'));
      $r['sub_type_a'] = wf_crm_aval($r, 'contact_sub_type_a');
      if (!is_null($r['sub_type_a'])) {
        $r['sub_type_a'] = strtolower($r['sub_type_a']);
      }
      $r['sub_type_b'] = wf_crm_aval($r, 'contact_sub_type_b');
      if (!is_null($r['sub_type_b'])) {
        $r['sub_type_b'] = strtolower($r['sub_type_b']);
      }
      $types[$r['id']] = $r;
    }
  }
  return $types;
}