From bc00ef9c70538d51029465c99043e04cd84d0f82 Mon Sep 17 00:00:00 2001 From: Civiware Solutions Date: Mon, 29 Oct 2018 08:01:34 +0530 Subject: [PATCH] Some code cleanups --- ftoverride.php | 10 +++++++++- .../CRM/Contribute/Form/ContributionMain/common.tpl | 2 +- .../CRM/Contribute/Form/ContributionPage/common.tpl | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ftoverride.php b/ftoverride.php index 6f3e127..09fbf38 100644 --- a/ftoverride.php +++ b/ftoverride.php @@ -197,6 +197,14 @@ function ftoverride_civicrm_entityTypes(&$entityTypes) { */ function ftoverride_civicrm_buildForm($formName, &$form) { if ('CRM_Contribute_Form_ContributionPage_Settings' == $formName) { + $showElement = TRUE; + if ($form->getVar('_id')) { + $snippet = CRM_Utils_Array::value('snippet', $_GET); + if (empty($snippet)) { + $showElement = FALSE; + } + } + $form->assign('showElement', $showElement); $financialTypes = []; CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $form->getVar('_action')); $form->add( @@ -266,7 +274,7 @@ function ftoverride_civicrm_buildForm($formName, &$form) { function ftoverride_civicrm_pre($op, $objectName, $id, &$params) { if (in_array($op, ['create', 'edit']) && $objectName == 'ContributionPage' - && !empty($params['designation']) + && isset($params['designation']) ) { if ($id) { $params['id'] = $id; diff --git a/templates/CRM/Contribute/Form/ContributionMain/common.tpl b/templates/CRM/Contribute/Form/ContributionMain/common.tpl index b0bb9ab..ca064c8 100644 --- a/templates/CRM/Contribute/Form/ContributionMain/common.tpl +++ b/templates/CRM/Contribute/Form/ContributionMain/common.tpl @@ -6,7 +6,7 @@ {literal} {/literal} diff --git a/templates/CRM/Contribute/Form/ContributionPage/common.tpl b/templates/CRM/Contribute/Form/ContributionPage/common.tpl index 2c446ad..23df5d1 100644 --- a/templates/CRM/Contribute/Form/ContributionPage/common.tpl +++ b/templates/CRM/Contribute/Form/ContributionPage/common.tpl @@ -1,3 +1,4 @@ +{if $showElement} @@ -11,3 +12,4 @@ }); {/literal} +{/if}
{$form.designation.label}