dev/core#4387 - CRM_Core_Form - Fix params passed to checkbox
authorcolemanw <coleman@civicrm.org>
Thu, 22 Jun 2023 03:09:50 +0000 (20:09 -0700)
committercolemanw <coleman@civicrm.org>
Thu, 22 Jun 2023 03:09:50 +0000 (20:09 -0700)
CRM/Core/Form.php

index ad88b3b020db1bcc9b5e301fa104b317630aaa8f..a00ab41054b47405d36bc1315ceb59d72ad9691e 100644 (file)
@@ -547,7 +547,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       unset($attributes['disabled']);
     }
 
-    $element = $this->addElement($type, $name, CRM_Utils_String::purifyHTML($label), $attributes, $extra);
+    if ($type === 'checkbox') {
+      $element = $this->addElement($type, $name, CRM_Utils_String::purifyHTML($label), NULL, $attributes);
+    }
+    else {
+      $element = $this->addElement($type, $name, CRM_Utils_String::purifyHTML($label), $attributes, $extra);
+    }
     if (HTML_QuickForm::isError($element)) {
       CRM_Core_Error::statusBounce(HTML_QuickForm::errorMessage($element));
     }