* RelationshipType
* @var array
*/
- private static $relationshipType;
+ private static $relationshipType = [];
/**
* Civicrm groups that are not smart groups
$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..
// Merge params with schema defaults
$params += [
- 'condition' => CRM_Utils_Array::value('condition', $pseudoconstant, []),
- 'keyColumn' => CRM_Utils_Array::value('keyColumn', $pseudoconstant),
- 'labelColumn' => CRM_Utils_Array::value('labelColumn', $pseudoconstant),
+ 'condition' => $pseudoconstant['condition'] ?? [],
+ 'keyColumn' => $pseudoconstant['keyColumn'] ?? NULL,
+ 'labelColumn' => $pseudoconstant['labelColumn'] ?? NULL,
];
// Fetch option group from option_value table
if ($values === FALSE) {
return FALSE;
}
- return CRM_Utils_Array::value($key, $values);
+ return $values[$key] ?? NULL;
}
/**
if ($values === FALSE) {
return FALSE;
}
- return CRM_Utils_Array::value($key, $values);
+ return $values[$key] ?? NULL;
}
/**
* array reference of all State/Provinces.
*/
public static function &stateProvince($id = FALSE, $limit = TRUE) {
- if (($id && !CRM_Utils_Array::value($id, self::$stateProvince)) || !self::$stateProvince || !$id) {
+ if (($id && empty(self::$stateProvince[$id])) || !self::$stateProvince || !$id) {
$whereClause = FALSE;
if ($limit) {
$countryIsoCodes = self::countryIsoCode();
* array reference of all countries.
*/
public static function country($id = FALSE, $applyLimit = TRUE) {
- if (($id && !CRM_Utils_Array::value($id, self::$country)) || !self::$country || !$id) {
+ if (($id && empty(self::$country[$id])) || !self::$country || !$id) {
$config = CRM_Core_Config::singleton();
$limitCodes = [];
* @return array
* array reference of all relationship types.
*/
- public static function &relationshipType($valueColumnName = 'label', $reset = FALSE, $isActive = 1) {
+ public static function relationshipType($valueColumnName = 'label', $reset = FALSE, $isActive = 1) {
$cacheKey = $valueColumnName . '::' . $isActive;
- if (!CRM_Utils_Array::value($cacheKey, self::$relationshipType) || $reset) {
+ if (!isset(self::$relationshipType[$cacheKey]) || $reset) {
self::$relationshipType[$cacheKey] = [];
//now we have name/label columns CRM-3336
if (empty(self::$paymentProcessorType[$cacheKey])) {
self::populate(self::$paymentProcessorType[$cacheKey], 'CRM_Financial_DAO_PaymentProcessorType', $all, $return, 'is_active', NULL, "is_default, $return", 'id');
}
- if ($id && CRM_Utils_Array::value($id, self::$paymentProcessorType[$cacheKey])) {
+ if ($id && !empty(self::$paymentProcessorType[$cacheKey][$id])) {
return self::$paymentProcessorType[$cacheKey][$id];
}
return self::$paymentProcessorType[$cacheKey];
$index .= '_' . $contactType;
}
- if (!CRM_Utils_Array::value($index, Civi::$statics[__CLASS__]['greeting'])) {
+ if (empty(Civi::$statics[__CLASS__]['greeting'][$index])) {
$filterCondition = NULL;
if ($contactType) {
$filterVal = 'v.filter =';
self::$accountOptionValues[$cacheKey] = CRM_Core_OptionGroup::values($optionGroupName, FALSE, FALSE, FALSE, $condition);
}
if ($id) {
- return CRM_Utils_Array::value($id, self::$accountOptionValues[$cacheKey]);
+ return self::$accountOptionValues[$cacheKey][$id] ?? NULL;
}
return self::$accountOptionValues[$cacheKey];