Cleanup admin form buttons
authorColeman Watts <coleman@civicrm.org>
Thu, 27 Feb 2014 15:17:48 +0000 (10:17 -0500)
committerColeman Watts <coleman@civicrm.org>
Thu, 27 Feb 2014 15:17:48 +0000 (10:17 -0500)
CRM/Admin/Form.php
CRM/Admin/Form/Tag.php
CRM/Badge/Form/Layout.php
CRM/Contact/Form/DedupeRules.php

index 2133e397946544e32248c9dbfbf8ba05eedd5d24..e74a298b8fe838928ed46c33703a458f49b4ed64 100644 (file)
@@ -106,27 +106,13 @@ class CRM_Admin_Form extends CRM_Core_Form {
   }
 
   /**
-   * Function to actually build the form
+   * Add standard buttons
    *
    * @return void
    * @access public
    */
   public function buildQuickForm() {
-    if ($this->_action & CRM_Core_Action::DELETE) {
-      $this->addButtons(array(
-          array(
-            'type' => 'next',
-            'name' => ts('Delete'),
-            'isDefault' => TRUE,
-          ),
-          array(
-            'type' => 'cancel',
-            'name' => ts('Cancel'),
-          ),
-        )
-      );
-    }
-    elseif ($this->_action & CRM_Core_Action::VIEW) {
+    if ($this->_action & CRM_Core_Action::VIEW) {
       $this->addButtons(array(
           array(
             'type' => 'cancel',
@@ -140,7 +126,7 @@ class CRM_Admin_Form extends CRM_Core_Form {
       $this->addButtons(array(
           array(
             'type' => 'next',
-            'name' => ts('Save'),
+            'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'),
             'isDefault' => TRUE,
           ),
           array(
index fc3f62a7f3ae1e7ea23ff500d6c7332efe4eff92..eb871d066b506263a783e447c08dcb319d9d7486 100644 (file)
@@ -54,20 +54,6 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
         CRM_Utils_System::redirect($url);
         return TRUE;
       }
-      else {
-        $this->addButtons(array(
-            array(
-              'type' => 'next',
-              'name' => ts('Delete'),
-              'isDefault' => TRUE,
-            ),
-            array(
-              'type' => 'cancel',
-              'name' => ts('Cancel'),
-            ),
-          )
-        );
-      }
     }
     else {
       $this->_isTagSet = CRM_Utils_Request::retrieve('tagset', 'Positive', $this);
@@ -128,8 +114,8 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
       }
       $this->assign('adminReservedTags', $adminReservedTags);
 
-      parent::buildQuickForm();
     }
+    parent::buildQuickForm();
   }
 
   /**
index 216f78f6f45b25d4e6a2f7c22d12a6b1c679bdd9..122a490d50a9150d1ac99460c3ba188428ce5cad 100644 (file)
@@ -48,19 +48,7 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form {
    */
   public function buildQuickForm() {
     if ($this->_action & CRM_Core_Action::DELETE) {
-      $this->addButtons(array(
-          array(
-            'type' => 'next',
-            'name' => ts('Delete'),
-            'isDefault' => TRUE,
-          ),
-          array(
-            'type' => 'cancel',
-            'name' => ts('Cancel'),
-          ),
-        )
-      );
-      return;
+      return parent::buildQuickForm();
     }
 
     $config = CRM_Core_Config::singleton();
index 15b4014c7a43feb42bd8133136d891d3cb181dd8..08d21ddb27c9651ecb71eeb49440612edb169ceb 100644 (file)
@@ -133,14 +133,12 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
     }
 
     $this->add('text', 'threshold', ts("Weight Threshold to Consider Contacts 'Matching':"), $attributes);
-    $this->addButtons(array(
-      array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE),
-      array('type' => 'cancel', 'name' => ts('Cancel')),
-    ));
 
     $this->assign('contact_type', $this->_contactType);
 
     $this->addFormRule(array('CRM_Contact_Form_DedupeRules', 'formRule'), $this);
+
+    parent::buildQuickForm();
   }
 
   /**