*/
public static function create($params) {
$hook = empty($params['id']) ? 'create' : 'edit';
- CRM_Utils_Hook::pre($hook, 'GroupNesting', CRM_Utils_Array::value('id', $params), $params);
+ CRM_Utils_Hook::pre($hook, 'GroupNesting', $params['id'] ?? NULL, $params);
$dao = new CRM_Contact_BAO_GroupNesting();
$dao->copyValues($params);
if (empty($params['id'])) {
if (!empty($relQill)) {
$relQill .= ' OR ';
}
- $relQill .= CRM_Utils_Array::value($rel, $allRelationshipType);
+ $relQill .= $allRelationshipType[$rel] ?? '';
}
$this->_qill[$grouping][] = 'Relationship Type(s) ' . $relQill . " ( " . implode(", ", $qillNames) . " )";
}
$pseudoOptions = CRM_Core_PseudoConstant::worldRegion();
}
elseif ($daoName == 'CRM_Event_DAO_Event' && $fieldName == 'id') {
- $checkPermission = CRM_Utils_Array::value('check_permission', $pseudoExtraParam, TRUE);
+ $checkPermission = $pseudoExtraParam['check_permission'] ?? TRUE;
$pseudoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, $checkPermission, TRUE);
}
elseif ($fieldName == 'contribution_product_id') {
// is not declared for them.
// @todo so far only integer fields are being handled. If we add string fields we need to look at
// escaping.
- $pseudoConstantMetadata = CRM_Utils_Array::value('pseudoconstant', $fieldSpec, FALSE);
+ $pseudoConstantMetadata = $fieldSpec['pseudoconstant'] ?? FALSE;
if (!empty($pseudoConstantMetadata)
) {
if (!empty($pseudoConstantMetadata['optionGroupName'])
// make we require one primary block, CRM-5505
if ($updateMode) {
if (!$hasPrimary) {
- $hasPrimary = CRM_Utils_Array::value(
- 'is_primary',
- CRM_Utils_Array::value($instance, $defaults[$name])
- );
+ $hasPrimary = !empty($defaults[$name][$instance]['is_primary']);
}
continue;
}
if (array_key_exists('CommunicationPreferences', $this->_editOptions)) {
// this is a chekbox, so mark false if we dont get a POST value
- $params['is_opt_out'] = CRM_Utils_Array::value('is_opt_out', $params, FALSE);
+ $params['is_opt_out'] = $params['is_opt_out'] ?? FALSE;
CRM_Utils_Array::formatArrayKeys($params['preferred_communication_method']);
}
for ($i = 0; $i < count($contactLinks['rows']); $i++) {
$row .= ' <tr> ';
$row .= ' <td class="matching-contacts-name"> ';
- $row .= CRM_Utils_Array::value('display_name', $contactLinks['rows'][$i]);
+ $row .= $contactLinks['rows'][$i]['display_name'] ?? '';
$row .= ' </td>';
$row .= ' <td class="matching-contacts-email"> ';
- $row .= CRM_Utils_Array::value('primary_email', $contactLinks['rows'][$i]);
+ $row .= $contactLinks['rows'][$i]['primary_email'] ?? '';
$row .= ' </td>';
$row .= ' <td class="action-items"> ';
- $row .= CRM_Utils_Array::value('view', $contactLinks['rows'][$i]);
- $row .= CRM_Utils_Array::value('edit', $contactLinks['rows'][$i]);
- $row .= CRM_Utils_Array::value('merge', $contactLinks['rows'][$i]);
+ $row .= $contactLinks['rows'][$i]['view'] ?? '';
+ $row .= $contactLinks['rows'][$i]['edit'] ?? '';
+ $row .= $contactLinks['rows'][$i]['merge'] ?? '';
$row .= ' </td>';
$row .= ' </tr> ';
}
$streetAddress .= ' ';
}
}
- $streetAddress .= CRM_Utils_Array::value($fld, $address);
+ $streetAddress .= $address[$fld] ?? '';
}
$address['street_address'] = trim($streetAddress);
$parseSuccess[$instance] = TRUE;
$streetAddress .= ' ';
}
}
- $streetAddress .= CRM_Utils_Array::value($fld, $address);
+ $streetAddress .= $address[$fld] ?? '';
}
$streetAddress = trim($streetAddress);
if (!empty($streetAddress)) {
// Process / save communication preferences
// this is a chekbox, so mark false if we dont get a POST value
- $params['is_opt_out'] = CRM_Utils_Array::value('is_opt_out', $params, FALSE);
+ $params['is_opt_out'] = $params['is_opt_out'] ?? FALSE;
$params['contact_type'] = $this->_contactType;
$params['contact_id'] = $this->_contactId;
$jsData[$id] = array_filter(array_intersect_key($allRelationshipNames[$id], $whatWeWant));
// Add user-friendly placeholder
foreach (['a', 'b'] as $x) {
- $type = !empty($jsData[$id]["contact_sub_type_$x"]) ? $jsData[$id]["contact_sub_type_$x"] : CRM_Utils_Array::value("contact_type_$x", $jsData[$id]);
+ $type = !empty($jsData[$id]["contact_sub_type_$x"]) ? $jsData[$id]["contact_sub_type_$x"] : (CRM_Utils_Array::value("contact_type_$x", $jsData[$id]));
$jsData[$id]["placeholder_$x"] = $type ? ts('- select %1 -', [strtolower($contactTypes[$type]['label'])]) : ts('- select contact -');
}
}
}
// If this is a b_a relationship these form elements are flipped
- $params['is_permission_a_b'] = CRM_Utils_Array::value("is_permission_{$a}_{$b}", $values, 0);
- $params['is_permission_b_a'] = CRM_Utils_Array::value("is_permission_{$b}_{$a}", $values, 0);
+ $params['is_permission_a_b'] = $values["is_permission_{$a}_{$b}"] ?? 0;
+ $params['is_permission_b_a'] = $values["is_permission_{$b}_{$a}"] ?? 0;
return [$params, $a];
}
}
}
$this->assign('id',
- CRM_Utils_Array::value('uf_group_id', $this->_formValues)
+ $this->_formValues['uf_group_id'] ?? NULL
);
$operator = CRM_Utils_Array::value('operator', $this->_formValues, CRM_Contact_BAO_Query::SEARCH_OPERATOR_AND);
$this->set('queryOperator', $operator);
}
if ($addressOptions['postal_code']) {
- $attr = ['class' => 'six'] + (array) CRM_Utils_Array::value('postal_code', $attributes);
+ $attr = ['class' => 'six'] + ($attributes['postal_code'] ?? []);
$form->addElement('text', 'postal_code_low', NULL, $attr + ['placeholder' => ts('From')]);
$form->addElement('text', 'postal_code_high', NULL, $attr + ['placeholder' => ts('To')]);
}
$queryOperator = 'AND';
}
$dao = $selector->contactIDQuery($params, $sortID,
- CRM_Utils_Array::value('display_relationship_type', $fv),
+ $fv['display_relationship_type'] ?? NULL,
$queryOperator
);
$cc,
$bcc,
$additionalDetails,
- CRM_Utils_Array::value('campaign_id', $formValues),
+ $formValues['campaign_id'] ?? NULL,
$this->getCaseID()
);
if (!empty($fv['location_type_id'])) {
foreach ($valuesothers as $vals) {
if (($vals['location_type_id'] ?? NULL) ==
- CRM_Utils_Array::value('location_type_id', $fv)
+ ($fv['location_type_id'] ?? NULL)
) {
foreach ($vals as $k => $v) {
if (in_array($k, [
if ($defaults['contact_type'] == 'Individual') {
$vcard->setName(CRM_Utils_Array::value('last_name', $defaults),
- CRM_Utils_Array::value('first_name', $defaults),
- CRM_Utils_Array::value('middle_name', $defaults),
- CRM_Utils_Array::value('prefix', $defaults),
- CRM_Utils_Array::value('suffix', $defaults)
+ $defaults['first_name'] ?? NULL,
+ $defaults['middle_name'] ?? NULL,
+ $defaults['prefix'] ?? NULL,
+ $defaults['suffix'] ?? NULL
);
$organizationName = $defaults['organization_name'] ?? NULL;
if ($organizationName !== NULL) {