From 9ca69805338baab6882b8d1cc887903f4b16eceb Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Sat, 20 Jun 2020 14:00:33 -0400 Subject: [PATCH] Cleanup with ?? --- CRM/Core/Form.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index f149bdecf3..f15287eee9 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -420,7 +420,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $attributes['data-crm-datepicker'] = json_encode((array) $extra); if (!empty($attributes['aria-label']) || $label) { - $attributes['aria-label'] = CRM_Utils_Array::value('aria-label', $attributes, $label); + $attributes['aria-label'] = $attributes['aria-label'] ?? $label; } $type = "text"; } @@ -1211,12 +1211,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $optAttributes = $attributes; if (!empty($optionAttributes[$key])) { foreach ($optionAttributes[$key] as $optAttr => $optVal) { - if (!empty($optAttributes[$optAttr])) { - $optAttributes[$optAttr] .= ' ' . $optVal; - } - else { - $optAttributes[$optAttr] = $optVal; - } + $optAttributes[$optAttr] = ltrim(($optAttributes[$optAttr] ?? '') . ' ' . $optVal); } } // We use a class here to avoid html5 issues with collapsed cutsomfield sets. @@ -2067,7 +2062,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { // Default properties $props['api'] = CRM_Utils_Array::value('api', $props, []); $props['entity'] = CRM_Core_DAO_AllCoreTables::convertEntityNameToCamel(CRM_Utils_Array::value('entity', $props, 'Contact')); - $props['class'] = ltrim(CRM_Utils_Array::value('class', $props, '') . ' crm-form-entityref'); + $props['class'] = ltrim(($props['class'] ?? '') . ' crm-form-entityref'); if (array_key_exists('create', $props) && empty($props['create'])) { unset($props['create']); -- 2.25.1