CRM/Activity - Refactor unnecessary uses of CRM_Utils_Array::value
authorcolemanw <coleman@civicrm.org>
Fri, 13 Oct 2023 23:43:55 +0000 (19:43 -0400)
committercolemanw <coleman@civicrm.org>
Sat, 14 Oct 2023 12:58:21 +0000 (08:58 -0400)
CRM/Activity/Form/Activity.php
CRM/Activity/Selector/Activity.php

index 001ea75742a96ce0ff2f648c69e0e9a8cfc9665d..cefbe57ae3770dd3f26e784a08104f17baba4db3 100644 (file)
@@ -550,12 +550,8 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
     if (isset($this->_activityId)) {
 
       if ($this->_context !== 'standalone') {
-        $this->assign('target_contact_value',
-          CRM_Utils_Array::value('target_contact_value', $defaults)
-        );
-        $this->assign('assignee_contact_value',
-          CRM_Utils_Array::value('assignee_contact_value', $defaults)
-        );
+        $this->assign('target_contact_value', $defaults['target_contact_value'] ?? NULL);
+        $this->assign('assignee_contact_value', $defaults['assignee_contact_value'] ?? NULL);
       }
 
       // Fixme: why are we getting the wrong keys from upstream?
@@ -596,7 +592,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
     }
 
     if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
-      $this->assign('delName', CRM_Utils_Array::value('subject', $defaults));
+      $this->assign('delName', $defaults['subject'] ?? NULL);
     }
 
     if ($this->_activityTypeFile) {
@@ -679,13 +675,13 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
           $this->addEntityRef($field, $values['label'], $attribute, $required);
         }
         else {
-          $this->add($values['type'], $field, $values['label'], $attribute, $required, CRM_Utils_Array::value('extra', $values));
+          $this->add($values['type'], $field, $values['label'], $attribute, $required, $values['extra'] ?? NULL);
         }
       }
     }
 
     // CRM-7362 --add campaigns.
-    CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
+    CRM_Campaign_BAO_Campaign::addCampaign($this, $this->_values['campaign_id'] ?? NULL);
 
     // Add engagement level CRM-7775
     $buildEngagementLevel = FALSE;
index f8682ae5a7baa29a027a136fc2010e1eb074666b..d6a2af75e694d8c2df0f038f5f388187672826ad 100644 (file)
@@ -417,11 +417,11 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
         $row['engagement_level'] = CRM_Utils_Array::value($engagementLevel, $engagementLevels, $engagementLevel);
       }
 
-      $actionLinks = $this->actionLinks(CRM_Utils_Array::value('activity_type_id', $row),
-        CRM_Utils_Array::value('source_record_id', $row),
+      $actionLinks = $this->actionLinks($row['activity_type_id'],
+        $row['source_record_id'] ?? NULL,
         // CRM-3553
         !empty($row['mailingId']),
-        CRM_Utils_Array::value('activity_id', $row),
+        $row['activity_id'] ?? NULL,
         $this->_key
       );