You are here

function wf_crm_get_matching_rules in Webform CiviCRM Integration 7.5

Same name and namespace in other branches
  1. 7.4 includes/utils.inc \wf_crm_get_matching_rules()

List dedupe rules available for a contact type

Parameters

string $contact_type:

Return value

array

1 call to wf_crm_get_matching_rules()
wf_crm_admin_form::buildContactTab in includes/wf_crm_admin_form.inc
Build fields for a contact

File

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

Code

function wf_crm_get_matching_rules($contact_type) {
  static $rules;
  $contact_type = ucfirst($contact_type);
  if (!$rules) {
    $rules = array_fill_keys([
      'Individual',
      'Organization',
      'Household',
    ], []);
    $values = wf_crm_apivalues('RuleGroup', 'get');
    foreach ($values as $value) {
      $rules[$value['contact_type']][$value['id']] = $value['title'];
    }
  }
  return $rules[$contact_type];
}