From 5f197d571f4f527bb7e0819292879d53afd01080 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 25 Mar 2023 14:08:00 +1300 Subject: [PATCH] Check presence of field, rather than extra smarty variable for whether to display the field --- CRM/Contribute/Form/SoftCredit.php | 5 ++--- templates/CRM/Contribute/Form/Contribution.tpl | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/SoftCredit.php b/CRM/Contribute/Form/SoftCredit.php index 648235a5d7..5ec45a8ba7 100644 --- a/CRM/Contribute/Form/SoftCredit.php +++ b/CRM/Contribute/Form/SoftCredit.php @@ -108,16 +108,15 @@ class CRM_Contribute_Form_SoftCredit { /** * Add PCP fields for the new contribution form and others. * - * @param CRM_Core_Form &$form + * @param CRM_Core_Form $form * The form being built. * @param string $suffix * A suffix to add to field names. */ - public static function addPCPFields(&$form, $suffix = '') { + public static function addPCPFields($form, $suffix = '') { // CRM-7368 allow user to set or edit PCP link for contributions $siteHasPCPs = CRM_Contribute_PseudoConstant::pcPage(); if (!CRM_Utils_Array::crmIsEmptyArray($siteHasPCPs)) { - $form->assign('siteHasPCPs', 1); // Fixme: Not a true entityRef field. Relies on PCP.js.tpl $form->add('text', "pcp_made_through_id$suffix", ts('Credit to a Personal Campaign Page'), ['class' => 'twenty', 'placeholder' => ts('- select -')]); // stores the label diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index 702832d7c1..ba4adbcf46 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -284,7 +284,7 @@ - {if $siteHasPCPs && !$payNow} + {if array_key_exists('pcp_made_through_id', $form) && !$payNow}
{ts}Personal Campaign Page{/ts} {help id="id-pcp"} -- 2.25.1