Fix some variables to always assign
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 15 Sep 2023 03:24:49 +0000 (15:24 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 15 Sep 2023 03:24:49 +0000 (15:24 +1200)
CRM/UF/Form/AbstractPreview.php

index a1e6c0414b16c3dac968fb8e4f62a58ffb09f635..87bd1eaa0b74a1c3bb3ab998b9af7d517985e453 100644 (file)
@@ -37,20 +37,11 @@ class CRM_UF_Form_AbstractPreview extends CRM_Core_Form {
    * @param bool $isSingleField
    * @param bool $flag
    */
-  public function setProfile($fields, $isSingleField = FALSE, $flag = FALSE) {
-    if ($isSingleField) {
-      $this->assign('previewField', $isSingleField);
-    }
-
-    if ($flag) {
-      $this->assign('viewOnly', FALSE);
-    }
-    else {
-      $this->assign('viewOnly', TRUE);
-    }
-
+  public function setProfile(array $fields, bool $isSingleField = FALSE, bool $flag = FALSE): void {
+    $this->assign('previewField', $isSingleField);
+    $this->assign('viewOnly', !$flag);
     $this->set('fieldId', NULL);
-    $this->assign("fields", $fields);
+    $this->assign('fields', $fields);
     $this->_fields = $fields;
   }