diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index fbea0cefd518..064cad9797b6 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -211,15 +211,15 @@ public static function get($daoName, $fieldName, $params = [], $context = NULL) $dao = new $daoName(); $fieldSpec = $dao->getFieldSpec($fieldName); - // Ensure we have the canonical name for this field - $fieldName = CRM_Utils_Array::value('name', $fieldSpec, $fieldName); - // Return false if field doesn't exist. if (empty($fieldSpec)) { return FALSE; } - elseif (!empty($fieldSpec['pseudoconstant'])) { + // Ensure we have the canonical name for this field + $fieldName = $fieldSpec['name'] ?? $fieldName; + + if (!empty($fieldSpec['pseudoconstant'])) { $pseudoconstant = $fieldSpec['pseudoconstant']; // if callback is specified..