From 7f2969260bf6c0e95eeec73afa4c99e23ac2f0c2 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Mon, 28 Sep 2015 17:38:44 +1300 Subject: [PATCH] CRM-17293 align payment processor interface between 4.6 & 4.7 --- CRM/Core/Payment.php | 12 ++++++++++++ CRM/Core/Payment/Form.php | 3 +-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 3a45446495..0051dc4cf5 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -101,6 +101,18 @@ abstract class CRM_Core_Payment { return $object; } + /** + * Opportunity for the payment processor to override the entire form build. + * + * @param CRM_Core_Form $form + * + * @return bool + * Should form building stop at this point? + */ + public function buildForm(&$form) { + return FALSE; + } + /** * Log payment notification message to forensic system log. * diff --git a/CRM/Core/Payment/Form.php b/CRM/Core/Payment/Form.php index 1b674b7ca2..a87a10b1f0 100644 --- a/CRM/Core/Payment/Form.php +++ b/CRM/Core/Payment/Form.php @@ -297,8 +297,7 @@ class CRM_Core_Payment_Form { // $processor->buildForm appears to be an undocumented (possibly unused) option for payment processors // which was previously available only in some form flows - if (!empty($form->_paymentProcessor) && !empty($form->_paymentProcessor['object']) && $form->_paymentProcessor['object']->isSupported('buildForm')) { - $form->_paymentProcessor['object']->buildForm($form); + if (!empty($form->_paymentProcessor) && !empty($form->_paymentProcessor['object']) && $form->_paymentProcessor['object']->buildForm($form)) { return NULL; } -- 2.25.1