You are here

function wf_crm_get_relationship_types in Webform CiviCRM Integration 7.3

Same name and namespace in other branches
  1. 7.5 includes/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

3 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_configure_form in ./webform_civicrm_admin.inc
Drupal form builder callback Form to configure CiviCRM options for a Webform
wf_crm_get_contact_relationship_types in ./webform_civicrm_utils.inc
Get valid relationship types for a given pair of contacts

File

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

Code

function wf_crm_get_relationship_types() {
  static $types = array();
  if (!$types) {
    $f = array(
      'id',
      'name_a_b',
      'name_b_a',
      'label_a_b',
      'label_b_a',
      'type_a',
      'type_b',
      'sub_type_a',
      'sub_type_b',
    );
    $sql = '
      SELECT id, name_a_b, name_b_a, label_a_b, label_b_a, LOWER(contact_type_a) AS type_a, LOWER(contact_type_b) AS type_b, contact_sub_type_a AS sub_type_a, contact_sub_type_b AS sub_type_b
      FROM civicrm_relationship_type
      WHERE is_active <> 0';
    $dao =& CRM_Core_DAO::executeQuery($sql);
    while ($dao
      ->fetch()) {
      foreach ($f as $field) {
        $types[$dao->id][$field] = $dao->{$field};
      }
    }
    $dao
      ->free();
  }
  return $types;
}