* RelationshipType
* @var array
*/
- private static $relationshipType;
+ private static $relationshipType = [];
/**
* Civicrm groups that are not smart groups
// Historically this was 'false' but according to the notes in
// CRM_Core_DAO::buildOptionsContext it should be context dependent.
// timidly changing for 'search' only to fix world_region in search options.
- $localizeDefault = in_array($context, ['search']) ? TRUE : FALSE;
+ $localizeDefault = in_array($context, ['search']);
// Merge params with defaults
$params += [
'grouping' => FALSE,
'localize' => $localizeDefault,
- 'onlyActive' => ($context == 'validate' || $context == 'get') ? FALSE : TRUE,
+ 'onlyActive' => !($context == 'validate' || $context == 'get'),
'fresh' => FALSE,
'context' => $context,
];
$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;
}
/**
$countryIsoCodes = self::countryIsoCode();
$defaultID = array_search(CRM_Core_BAO_Country::defaultContactCountry(), $countryIsoCodes);
if ($defaultID !== FALSE) {
- $default[$defaultID] = CRM_Utils_Array::value($defaultID, self::$country);
+ $default[$defaultID] = self::$country[$defaultID] ?? NULL;
self::$country = $default + self::$country;
}
}
* @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
$index = $filter['greeting_type'] . '_' . $columnName;
// also add contactType to the array
- $contactType = CRM_Utils_Array::value('contact_type', $filter);
+ $contactType = $filter['contact_type'] ?? NULL;
if ($contactType) {
$index .= '_' . $contactType;
}
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];