From 9b324cefb38734c5bda53e00693a56040b466a97 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 7 Jun 2022 20:32:57 +1200 Subject: [PATCH] Minor extraction - addFormButtons shared code --- CRM/Activity/Import/Form/MapField.php | 18 +----------------- CRM/Contact/Import/Form/MapField.php | 17 +---------------- CRM/Contribute/Import/Form/MapField.php | 17 +---------------- CRM/Event/Import/Form/MapField.php | 17 +---------------- CRM/Import/Form/MapField.php | 22 ++++++++++++++++++++++ CRM/Member/Import/Form/MapField.php | 17 +---------------- 6 files changed, 27 insertions(+), 81 deletions(-) diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index e9b6c65106..4a2baab5f2 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -205,23 +205,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { $this->setDefaults($defaults); - $this->addButtons([ - [ - 'type' => 'back', - 'name' => ts('Previous'), - ], - [ - 'type' => 'next', - 'name' => ts('Continue'), - 'spacing' => '          ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + $this->addFormButtons(); } /** diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index ab9a71cc07..4c24a7edff 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -330,22 +330,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $this->setDefaults($defaults); - $this->addButtons([ - [ - 'type' => 'back', - 'name' => ts('Previous'), - ], - [ - 'type' => 'next', - 'name' => ts('Continue'), - 'spacing' => '          ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ]); + $this->addFormButtons(); } /** diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index 60c8cc3e41..61fc448a5b 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -276,22 +276,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $this->setDefaults($defaults); - $this->addButtons([ - [ - 'type' => 'back', - 'name' => ts('Previous'), - ], - [ - 'type' => 'next', - 'name' => ts('Continue'), - 'spacing' => '          ', - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ]); + $this->addFormButtons(); } /** diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php index 33228af045..39a78bc2b4 100644 --- a/CRM/Event/Import/Form/MapField.php +++ b/CRM/Event/Import/Form/MapField.php @@ -237,22 +237,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $this->setDefaults($defaults); - $this->addButtons(array( - array( - 'type' => 'back', - 'name' => ts('Previous'), - ), - array( - 'type' => 'next', - 'name' => ts('Continue'), - 'spacing' => '          ', - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - ), - )); + $this->addFormButtons(); } /** diff --git a/CRM/Import/Form/MapField.php b/CRM/Import/Form/MapField.php index 26f9030778..58413cd3b4 100644 --- a/CRM/Import/Form/MapField.php +++ b/CRM/Import/Form/MapField.php @@ -92,6 +92,28 @@ abstract class CRM_Import_Form_MapField extends CRM_Import_Forms { $parser->validate(); } + /** + * Add the form buttons. + */ + protected function addFormButtons(): void { + $this->addButtons([ + [ + 'type' => 'back', + 'name' => ts('Previous'), + ], + [ + 'type' => 'next', + 'name' => ts('Continue'), + 'spacing' => '          ', + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); + } + /** * Attempt to match header labels with our mapper fields. * diff --git a/CRM/Member/Import/Form/MapField.php b/CRM/Member/Import/Form/MapField.php index ef105204e9..b5c93fb324 100644 --- a/CRM/Member/Import/Form/MapField.php +++ b/CRM/Member/Import/Form/MapField.php @@ -140,22 +140,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $this->setDefaults($defaults); - $this->addButtons(array( - array( - 'type' => 'back', - 'name' => ts('Previous'), - ), - array( - 'type' => 'next', - 'name' => ts('Continue'), - 'spacing' => '          ', - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - ), - )); + $this->addFormButtons(); } /** -- 2.25.1