function wf_crm_search_filters in Webform CiviCRM Integration 7.4
Same name and namespace in other branches
- 7.5 includes/contact_component.inc \wf_crm_search_filters()
- 7.3 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
4 calls to wf_crm_search_filters()
- wf_crm_fill_contact_value in includes/
contact_component.inc - Lookup contact name from ID, verify permissions, and attach as html data.
- wf_crm_webform_ajax::contactAjax in includes/
wf_crm_webform_ajax.inc - Load one or more contacts via ajax
- wf_crm_webform_base::findContact in includes/
wf_crm_webform_base.inc - Find an existing contact based on matching criteria Used to populate a webform existing contact field
- wf_crm_webform_postprocess::verifyExistingContact in includes/
wf_crm_webform_postprocess.inc - Ensure we have a valid contact id in a contact ref field
File
- includes/
contact_component.inc, line 1058
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 (is_array($val)) {
$val = array_filter($val);
}
if (!empty($val)) {
if ($key === 'tag' || $key === 'group') {
$val = array_fill_keys($val, 1);
}
$params[$key] = $val;
}
}
return $params;
}