You are here

function wf_crm_get_relationship_types in Webform CiviCRM Integration 7.5

Same name and namespace in other branches
  1. 7.3 webform_civicrm_utils.inc \wf_crm_get_relationship_types()
  2. 7.4 includes/utils.inc \wf_crm_get_relationship_types()

Get relationship type data

Return value

array

5 calls to wf_crm_get_relationship_types()
webform_civicrm_update_7300 in ./webform_civicrm.install
Note: There are differences in how contact references and relationships work in the 3.x branch. Read the upgrade instructions at http://drupal.org/node/1615380
wf_crm_admin_component::preprocessComponentsForm in includes/wf_crm_admin_component.inc
Add CiviCRM info and theming to webform components form.
wf_crm_admin_form::addResources in includes/wf_crm_admin_form.inc
Add necessary css & js
wf_crm_get_contact_relationship_types in includes/utils.inc
Get valid relationship types for a given pair of contacts
wf_crm_get_fields in includes/utils.inc
Fetches CiviCRM field data.

File

includes/utils.inc, line 396
Webform CiviCRM module's common utility functions.

Code

function wf_crm_get_relationship_types() {
  static $types = [];
  if (!$types) {
    foreach (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');
      $r['sub_type_b'] = wf_crm_aval($r, 'contact_sub_type_b');
      $types[$r['id']] = $r;
    }
  }
  return $types;
}