+ $caseTypes = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+
+ // format case type, to fetch xml definition
+ return _civicrm_api3_case_type_get_formatResult($caseTypes);
+}
+
+/**
+ * Function to format definition
+ *
+ * @param $caseTypes
+ * @return mixed
+ */
+function _civicrm_api3_case_type_get_formatResult(&$result) {
+ foreach ($result['values'] as $key => $caseType) {
+ $xml = CRM_Case_XMLRepository::singleton()->retrieve($caseType['name']);
+ if ($xml) {
+ $result['values'][$key]['definition'] = CRM_Case_BAO_CaseType::convertXmlToDefinition($xml);
+ } else {
+ $result['values'][$key]['definition'] = array();
+ }
+ }
+ return $result;