static protected $_xml;
+ static protected $_hookCache = NULL;
+
function retrieve($caseType) {
- // trim all spaces from $caseType
- $caseType = str_replace('_', ' ', $caseType);
- $caseType = CRM_Utils_String::munge(ucwords($caseType), '', 0);
+ $caseType = self::mungeCaseType($caseType);
if (!CRM_Utils_Array::value($caseType, self::$_xml)) {
if (!self::$_xml) {
)
);
}
+
+ if (!file_exists($fileName)) {
+ if (self::$_hookCache === NULL) {
+ self::$_hookCache = array();
+ CRM_Utils_Hook::caseTypes(self::$_hookCache);
+ }
+ if (isset(self::$_hookCache[$caseType], self::$_hookCache[$caseType]['file'])) {
+ $fileName = self::$_hookCache[$caseType]['file'];
+ }
+ }
+
if (!file_exists($fileName)) {
return FALSE;
}
return self::$_xml[$caseType];
}
+ public static function mungeCaseType($caseType) {
+ // trim all spaces from $caseType
+ $caseType = str_replace('_', ' ', $caseType);
+ $caseType = CRM_Utils_String::munge(ucwords($caseType), '', 0);
+ return $caseType;
+ }
+
function &allActivityTypes($indexName = TRUE, $all = FALSE) {
static $activityTypes = NULL;
if (!$activityTypes) {
);
}
+ /**
+ * This hook is called when locating CiviCase types.
+ *
+ * @param array $caseTypes
+ * @return void
+ */
+ static function caseTypes(&$caseTypes) {
+ return self::singleton()->invoke(1, $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes');
+ }
+
/**
* This hook is called soon after the CRM_Core_Config object has ben initialized.
* You can use this hook to modify the config object and hence behavior of CiviCRM dynamically.