Merge pull request #15338 from totten/master-poc-postcommit
[civicrm-core.git] / api / v3 / Profile.php
index 73ea34dc7ae534d6577aee01f128ea212f193b38..17463bb1a3a003cd5446567da43ca658b0bc71d7 100644 (file)
@@ -515,10 +515,10 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour =
     $profileFields[$profileID][$fieldName] = array_merge([
       'api.required' => $field['is_required'],
       'title' => $field['label'],
-      'help_pre' => CRM_Utils_Array::value('help_pre', $field),
-      'help_post' => CRM_Utils_Array::value('help_post', $field),
+      'help_pre' => $field['help_pre'] ?? NULL,
+      'help_post' => $field['help_post'] ?? NULL,
       'entity' => $entity,
-      'weight' => CRM_Utils_Array::value('weight', $field),
+      'weight' => $field['weight'] ?? NULL,
     ], $aliasArray);
 
     $ufFieldTaleFieldName = $field['field_name'];
@@ -608,13 +608,13 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour =
 }
 
 /**
- * @param $a
- * @param $b
+ * @param array $a
+ * @param array $b
  *
  * @return bool
  */
 function _civicrm_api3_order_by_weight($a, $b) {
-  return CRM_Utils_Array::value('weight', $b) < CRM_Utils_Array::value('weight', $a) ? TRUE : FALSE;
+  return ($b['weight'] ?? 0) < ($a['weight'] ?? 0);
 }
 
 /**
@@ -731,7 +731,7 @@ function _civicrm_api3_profile_appendaliases($values, $entity) {
   }
   //special case on membership & contribution - can't see how to handle in a generic way
   if (in_array($entity, ['membership', 'contribution'])) {
-    $values['send_receipt'] = ['title' => 'Send Receipt', 'type' => (int) 16];
+    $values['send_receipt'] = ['title' => 'Send Receipt', 'type' => 16];
   }
   return $values;
 }