From a8b477f6235dc2d2adc987c46a9addaa89f1b39f Mon Sep 17 00:00:00 2001 From: "Matthew Wire (MJW Consulting)" Date: Sun, 23 Jun 2019 13:05:24 +0100 Subject: [PATCH] Simple cleanup of tabset code for contributionpages --- .../Form/ContributionPage/TabHeader.php | 62 +++++-------------- 1 file changed, 17 insertions(+), 45 deletions(-) diff --git a/CRM/Contribute/Form/ContributionPage/TabHeader.php b/CRM/Contribute/Form/ContributionPage/TabHeader.php index c24edb0726e8..0bf6b9373698 100644 --- a/CRM/Contribute/Form/ContributionPage/TabHeader.php +++ b/CRM/Contribute/Form/ContributionPage/TabHeader.php @@ -68,73 +68,45 @@ public static function process(&$form) { return NULL; } + $default = [ + 'link' => NULL, + 'valid' => FALSE, + 'active' => FALSE, + 'current' => FALSE, + ]; + $tabs = [ 'settings' => [ 'title' => ts('Title'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, 'amount' => [ 'title' => ts('Amounts'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, 'membership' => [ 'title' => ts('Memberships'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, 'thankyou' => [ 'title' => ts('Receipt'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, 'friend' => [ 'title' => ts('Tell a Friend'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, 'custom' => [ 'title' => ts('Profiles'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, 'premium' => [ 'title' => ts('Premiums'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, 'widget' => [ 'title' => ts('Widgets'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, 'pcp' => [ 'title' => ts('Personal Campaigns'), - 'link' => NULL, - 'valid' => FALSE, - 'active' => FALSE, - 'current' => FALSE, - ], + ] + $default, ]; $contribPageId = $form->getVar('_id'); + // Call tabset hook to add/remove custom tabs CRM_Utils_Hook::tabset('civicrm/admin/contribute', $tabs, ['contribution_page_id' => $contribPageId]); $fullName = $form->getVar('_name'); $className = CRM_Utils_String::getClassName($fullName);