Merge pull request #2657 from kurund/test-fixes
[civicrm-core.git] / CRM / Core / Form.php
index 1cc85bf9cde7a0c9e6db1bc11b6aa66adfc0936f..9d6e0603bddd98197118b5254e7d1a7ad71c640d 100644 (file)
@@ -223,7 +223,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     $attributes = '', $required = FALSE, $extra = NULL
   ) {
     // Normalize this property
-    if ($type == 'select' && !empty($extra['multiple'])) {
+    if ($type == 'select' && is_array($extra) && !empty($extra['multiple'])) {
       $extra['multiple'] = 'multiple';
     }
     $element = $this->addElement($type, $name, $label, $attributes, $extra);
@@ -443,6 +443,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         $attrs = array_merge($js, $attrs);
       }
 
+      if ($button['type'] === 'cancel') {
+        $attrs['class'] .= ' cancel';
+      }
+
       if ($button['type'] === 'reset') {
         $prevnext[] = $this->createElement($button['type'], 'reset', $button['name'], $attrs);
       }
@@ -454,8 +458,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
           $buttonName = $this->getButtonName($button['type']);
         }
 
-        if (in_array($button['type'], array(
-          'next', 'upload')) && $button['name'] === 'Save') {
+        if (in_array($button['type'], array('next', 'upload', 'done')) && $button['name'] === ts('Save')) {
           $attrs = array_merge($attrs, (array('accesskey' => 'S')));
         }
         $prevnext[] = $this->createElement('submit', $buttonName, $button['name'], $attrs);