Improved support for case variability in UF* API calls.
authorFrank J. Gómez <frank@ginkgostreet.com>
Fri, 21 Dec 2018 20:03:48 +0000 (15:03 -0500)
committerFrank J. Gómez <frank@ginkgostreet.com>
Fri, 21 Dec 2018 20:03:48 +0000 (15:03 -0500)
CRM/Utils/String.php

index 2225befa961d23e52465e0e1ac13c2a98b4c55cd..b45c228ae79d9d45600c3976fdbe728fca5d3470 100644 (file)
@@ -120,8 +120,12 @@ class CRM_Utils_String {
     $fragments = explode('_', $string);
     foreach ($fragments as & $fragment) {
       $fragment = ucfirst($fragment);
+      // Special case: UFGroup, UFJoin, UFMatch, UFField (if passed in without underscores)
+      if (strpos($fragment, 'Uf') === 0 && strlen($string) > 2) {
+        $fragment = 'UF' . ucfirst(substr($fragment, 2));
+      }
     }
-    // Special case: UFGroup, UFJoin, UFMatch, UFField
+    // Special case: UFGroup, UFJoin, UFMatch, UFField (if passed in underscore-separated)
     if ($fragments[0] === 'Uf') {
       $fragments[0] = 'UF';
     }