You are here

function wf_crm_search_filters in Webform CiviCRM Integration 7.3

Same name and namespace in other branches
  1. 7.5 includes/contact_component.inc \wf_crm_search_filters()
  2. 7.4 includes/contact_component.inc \wf_crm_search_filters()

Format filters for the contact get api

Parameters

$node: Webform node object

$component: Webform component of type 'civicrm_contact'

Return value

array Api params

5 calls to wf_crm_search_filters()
wf_crm_ajax in ./contact_component.inc
Drupal page callback to serve AJAX requests.
wf_crm_fill_contact_value in ./contact_component.inc
Lookup contact name from ID, verify permissions, and attach as html data. Used when rendering or altering a CiviCRM contact field
wf_crm_find_contact in ./contact_component.inc
Find an existing contact based on matching criteria Used to autopopulate a webform existing contact field
wf_crm_process_submission in ./webform_civicrm_forms.inc
Webform submission handler Create/update CiviCRM contacts and related data Called by presave, insert and update webform hooks
_webform_render_civicrm_contact in ./contact_component.inc
Implements _webform_render_component().

File

./contact_component.inc, line 949

Code

function wf_crm_search_filters($node, $component) {
  $params = array(
    'is_deleted' => 0,
  );
  list(, $c, ) = explode('_', $component['form_key'], 3);
  $params['contact_type'] = ucfirst($node->webform_civicrm['data']['contact'][$c]['contact'][1]['contact_type']);
  foreach ($component['extra']['filters'] as $key => $val) {
    if (!empty($val)) {
      if ($key === 'tag' || $key === 'group') {
        $val = array_fill_keys($val, 1);
      }
      $params[$key] = $val;
    }
  }
  return $params;
}