function wf_crm_get_case_roles_options in Webform CiviCRM Integration 7.5
Same name and namespace in other branches
- 7.4 includes/contact_component.inc \wf_crm_get_case_roles_options()
Returns a list of all case roles
Return value
array
1 call to wf_crm_get_case_roles_options()
- _webform_edit_civicrm_contact in includes/
contact_component.inc - Implements _webform_edit_component().
File
- includes/
contact_component.inc, line 986
Code
function wf_crm_get_case_roles_options() {
$filters = [
'return' => [
"definition",
],
'options' => [
'limit' => 0,
],
];
$result = wf_civicrm_api('CaseType', 'get', $filters);
$options = [];
$options['case_client'] = t('Case Client');
foreach ($result['values'] as $k => $val) {
if (isset($val['definition']['caseRoles'])) {
foreach ($val['definition']['caseRoles'] as $caseRole) {
$caseRoleID = wf_civicrm_api('RelationshipType', 'get', [
'sequential' => 1,
'return' => [
"id",
"label_b_a",
"label_a_b",
],
'name_b_a' => $caseRole['name'],
'label_b_a' => $caseRole['name'],
'options' => [
'or' => [
[
"name_b_a",
"label_b_a",
],
],
],
])['values'][0];
$options[$caseRoleID['id']] = $caseRoleID['label_b_a'];
}
}
}
return $options;
}