Merge pull request #17277 from mattwire/fatalerrorhandler
[civicrm-core.git] / CRM / Core / QuickForm / GroupMultiSelect.php
index fe20778e805f7a693c49e7e54cf19e64fec0a55d..35a959ad942b6edf938d6c5bc265e4d87a9ba13b 100644 (file)
@@ -34,6 +34,7 @@
  *
  */
 class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMultiSelect {
+
   /**
    * Returns the HTML generated for the advanced multiple select component.
    *
@@ -65,8 +66,8 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
 
       foreach ($this->_options as $option) {
 
-        $_labelAttributes = array('style', 'class', 'onmouseover', 'onmouseout');
-        $labelAttributes = array();
+        $_labelAttributes = ['style', 'class', 'onmouseover', 'onmouseout'];
+        $labelAttributes = [];
         foreach ($_labelAttributes as $attr) {
           if (isset($option['attr'][$attr])) {
             $labelAttributes[$attr] = $option['attr'][$attr];
@@ -92,19 +93,19 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
       $strHtmlRemove = '';
 
       // build the select all button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}('" . $this->getName() . "', 1);");
+      $attributes = ['onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}('" . $this->getName() . "', 1);"];
       $this->_allButtonAttributes = array_merge($this->_allButtonAttributes, $attributes);
       $attrStrAll = $this->_getAttrString($this->_allButtonAttributes);
       $strHtmlAll = "<input$attrStrAll />" . PHP_EOL;
 
       // build the select none button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}('" . $this->getName() . "', 0);");
+      $attributes = ['onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}('" . $this->getName() . "', 0);"];
       $this->_noneButtonAttributes = array_merge($this->_noneButtonAttributes, $attributes);
       $attrStrNone = $this->_getAttrString($this->_noneButtonAttributes);
       $strHtmlNone = "<input$attrStrNone />" . PHP_EOL;
 
       // build the toggle selection button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}('" . $this->getName() . "', 2);");
+      $attributes = ['onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}('" . $this->getName() . "', 2);"];
       $this->_toggleButtonAttributes = array_merge($this->_toggleButtonAttributes, $attributes);
       $attrStrToggle = $this->_getAttrString($this->_toggleButtonAttributes);
       $strHtmlToggle = "<input$attrStrToggle />" . PHP_EOL;
@@ -116,26 +117,26 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
       // ... or a dual multi-select
 
       // set name of Select From Box
-      $this->_attributesUnselected = array(
+      $this->_attributesUnselected = [
         'name' => '__' . $selectName,
         'ondblclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'add')",
-      );
+      ];
       $this->_attributesUnselected = array_merge($this->_attributes, $this->_attributesUnselected);
       $attrUnselected = $this->_getAttrString($this->_attributesUnselected);
 
       // set name of Select To Box
-      $this->_attributesSelected = array(
+      $this->_attributesSelected = [
         'name' => '_' . $selectName,
         'ondblclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'remove')",
-      );
+      ];
       $this->_attributesSelected = array_merge($this->_attributes, $this->_attributesSelected);
       $attrSelected = $this->_getAttrString($this->_attributesSelected);
 
       // set name of Select hidden Box
-      $this->_attributesHidden = array(
+      $this->_attributesHidden = [
         'name' => $selectName,
         'style' => 'overflow: hidden; visibility: hidden; width: 1px; height: 0;',
-      );
+      ];
       $this->_attributesHidden = array_merge($this->_attributes, $this->_attributesHidden);
       $attrHidden = $this->_getAttrString($this->_attributesHidden);
 
@@ -145,11 +146,11 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
         $arrHtmlSelected = array_fill(0, $append, ' ');
       }
       else {
-        $arrHtmlSelected = array();
+        $arrHtmlSelected = [];
       }
 
       $options = count($this->_options);
-      $arrHtmlUnselected = array();
+      $arrHtmlUnselected = [];
       if ($options > 0) {
         $arrHtmlHidden = array_fill(0, $options, ' ');
 
@@ -176,7 +177,7 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
         }
       }
       else {
-        $arrHtmlHidden = array();
+        $arrHtmlHidden = [];
       }
 
       // The 'unselected' multi-select which appears on the left
@@ -207,43 +208,43 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
       $strHtmlHidden .= '</select>';
 
       // build the remove button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'remove'); return false;");
+      $attributes = ['onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'remove'); return false;"];
       $this->_removeButtonAttributes = array_merge($this->_removeButtonAttributes, $attributes);
       $attrStrRemove = $this->_getAttrString($this->_removeButtonAttributes);
       $strHtmlRemove = "<input$attrStrRemove />" . PHP_EOL;
 
       // build the add button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'add'); return false;");
+      $attributes = ['onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'add'); return false;"];
       $this->_addButtonAttributes = array_merge($this->_addButtonAttributes, $attributes);
       $attrStrAdd = $this->_getAttrString($this->_addButtonAttributes);
       $strHtmlAdd = "<input$attrStrAdd />" . PHP_EOL;
 
       // build the select all button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'all'); return false;");
+      $attributes = ['onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'all'); return false;"];
       $this->_allButtonAttributes = array_merge($this->_allButtonAttributes, $attributes);
       $attrStrAll = $this->_getAttrString($this->_allButtonAttributes);
       $strHtmlAll = "<input$attrStrAll />" . PHP_EOL;
 
       // build the select none button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'none'); return false;");
+      $attributes = ['onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'none'); return false;"];
       $this->_noneButtonAttributes = array_merge($this->_noneButtonAttributes, $attributes);
       $attrStrNone = $this->_getAttrString($this->_noneButtonAttributes);
       $strHtmlNone = "<input$attrStrNone />" . PHP_EOL;
 
       // build the toggle button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'toggle'); return false;");
+      $attributes = ['onclick' => "{$this->_jsPrefix}{$this->_jsPostfix}(this.form.elements['__" . $selectName . "'], this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "'], 'toggle'); return false;"];
       $this->_toggleButtonAttributes = array_merge($this->_toggleButtonAttributes, $attributes);
       $attrStrToggle = $this->_getAttrString($this->_toggleButtonAttributes);
       $strHtmlToggle = "<input$attrStrToggle />" . PHP_EOL;
 
       // build the move up button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}moveUp(this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "']); return false;");
+      $attributes = ['onclick' => "{$this->_jsPrefix}moveUp(this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "']); return false;"];
       $this->_upButtonAttributes = array_merge($this->_upButtonAttributes, $attributes);
       $attrStrUp = $this->_getAttrString($this->_upButtonAttributes);
       $strHtmlMoveUp = "<input$attrStrUp />" . PHP_EOL;
 
       // build the move down button with all its attributes
-      $attributes = array('onclick' => "{$this->_jsPrefix}moveDown(this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "']); return false;");
+      $attributes = ['onclick' => "{$this->_jsPrefix}moveDown(this.form.elements['_" . $selectName . "'], this.form.elements['" . $selectName . "']); return false;"];
       $this->_downButtonAttributes = array_merge($this->_downButtonAttributes, $attributes);
       $attrStrDown = $this->_getAttrString($this->_downButtonAttributes);
       $strHtmlMoveDown = "<input$attrStrDown />" . PHP_EOL;
@@ -271,7 +272,7 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
       $strHtml = preg_replace('/\s*<!-- BEGIN label_(\S+) -->.*<!-- END label_\1 -->\s*/i', '', $strHtml);
     }
 
-    $placeHolders = array(
+    $placeHolders = [
       '{stylesheet}',
       '{javascript}',
       '{class}',
@@ -284,8 +285,8 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
       '{toggle}',
       '{moveup}',
       '{movedown}',
-    );
-    $htmlElements = array(
+    ];
+    $htmlElements = [
       $this->getElementCss(FALSE),
       $this->getElementJs(FALSE),
       $this->_tableAttributes,
@@ -298,7 +299,7 @@ class CRM_Core_QuickForm_GroupMultiSelect extends CRM_Core_QuickForm_NestedAdvMu
       $strHtmlToggle,
       $strHtmlMoveUp,
       $strHtmlMoveDown,
-    );
+    ];
 
     $strHtml = str_replace($placeHolders, $htmlElements, $strHtml);