diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index 44309594fb4f..0d4fb20c9217 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -536,24 +536,23 @@ private function getPhpNullable($fieldXML) { * @return string */ public function composeTitle($name) { + $substitutions = [ + 'is_active' => 'Enabled', + ]; + if (isset($substitutions[$name])) { + return $substitutions[$name]; + } $names = explode('_', strtolower($name)); - $title = ''; - for ($i = 0; $i < count($names); $i++) { - if ($names[$i] === 'id' || $names[$i] === 'is') { - // id's do not get titles - return NULL; - } - - if ($names[$i] === 'im') { - $names[$i] = 'IM'; + $allCaps = ['im', 'id']; + foreach ($names as $i => $str) { + if (in_array($str, $allCaps, TRUE)) { + $names[$i] = strtoupper($str); } else { - $names[$i] = ucfirst(trim($names[$i])); + $names[$i] = ucfirst(trim($str)); } - - $title = $title . ' ' . $names[$i]; } - return trim($title); + return trim(implode(' ', $names)); } /**