+ if (!empty($params['id']) // this is an existing case-type
+ && !CRM_Case_BAO_CaseType::isForked($params['id']) // which is not yet forked
+ && !CRM_Case_BAO_CaseType::isForkable($params['id']) // for which new forks are prohibited
+ ) {
+ unset($params['definition']);
+ }
+ $result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'CaseType');
+ return _civicrm_api3_case_type_get_formatResult($result);