From a1f552a95c7b48777e3d758dd567919e43b622eb Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 27 Feb 2014 10:17:48 -0500 Subject: [PATCH] Cleanup admin form buttons --- CRM/Admin/Form.php | 20 +++----------------- CRM/Admin/Form/Tag.php | 16 +--------------- CRM/Badge/Form/Layout.php | 14 +------------- CRM/Contact/Form/DedupeRules.php | 6 ++---- 4 files changed, 7 insertions(+), 49 deletions(-) diff --git a/CRM/Admin/Form.php b/CRM/Admin/Form.php index 2133e39794..e74a298b8f 100644 --- a/CRM/Admin/Form.php +++ b/CRM/Admin/Form.php @@ -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( diff --git a/CRM/Admin/Form/Tag.php b/CRM/Admin/Form/Tag.php index fc3f62a7f3..eb871d066b 100644 --- a/CRM/Admin/Form/Tag.php +++ b/CRM/Admin/Form/Tag.php @@ -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(); } /** diff --git a/CRM/Badge/Form/Layout.php b/CRM/Badge/Form/Layout.php index 216f78f6f4..122a490d50 100644 --- a/CRM/Badge/Form/Layout.php +++ b/CRM/Badge/Form/Layout.php @@ -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(); diff --git a/CRM/Contact/Form/DedupeRules.php b/CRM/Contact/Form/DedupeRules.php index 15b4014c7a..08d21ddb27 100644 --- a/CRM/Contact/Form/DedupeRules.php +++ b/CRM/Contact/Form/DedupeRules.php @@ -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(); } /** -- 2.25.1