本文整理匯總了PHP中CRM_Core_Payment_Form::setBillingDetailsFields方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_Payment_Form::setBillingDetailsFields方法的具體用法?PHP CRM_Core_Payment_Form::setBillingDetailsFields怎麽用?PHP CRM_Core_Payment_Form::setBillingDetailsFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Core_Payment_Form
的用法示例。
在下文中一共展示了CRM_Core_Payment_Form::setBillingDetailsFields方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setPaymentFieldsByProcessor
/**
* Add payment fields depending on payment processor. The payment processor can implement the following functions to override the built in fields.
*
* - getPaymentFormFields()
* - getPaymentFormFieldsMetadata()
* (planned - getBillingDetailsFormFields(), getBillingDetailsFormFieldsMetadata()
*
* Note that this code is written to accommodate the possibility CiviCRM will switch to implementing pay later as a manual processor in future
*
* @param CRM_Contribute_Form_AbstractEditPayment|CRM_Contribute_Form_Contribution_Main $form
* @param array $processor
* Array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors.
* @param bool $forceBillingFieldsForPayLater
* Display billing fields even for pay later.
*/
public static function setPaymentFieldsByProcessor(&$form, $processor, $forceBillingFieldsForPayLater = FALSE)
{
$form->billingFieldSets = array();
if ($processor != NULL) {
// ie it is pay later
$paymentFields = self::getPaymentFields($processor);
$paymentTypeName = self::getPaymentTypeName($processor);
$paymentTypeLabel = self::getPaymentTypeLabel($processor);
//@todo if we switch to iterating through $form->billingFieldSets we won't need to assign these directly
$form->assign('paymentTypeName', $paymentTypeName);
$form->assign('paymentTypeLabel', $paymentTypeLabel);
$form->billingFieldSets[$paymentTypeName]['fields'] = $form->_paymentFields = array_intersect_key(self::getPaymentFieldMetadata($processor), array_flip($paymentFields));
$form->billingPane = array($paymentTypeName => $paymentTypeLabel);
$form->assign('paymentFields', $paymentFields);
}
// @todo - replace this section with one similar to above per discussion - probably use a manual processor shell class to stand in for that capability
//return without adding billing fields if billing_mode = 4 (@todo - more the ability to set that to the payment processor)
// or payment processor is NULL (pay later)
if ($processor == NULL && !$forceBillingFieldsForPayLater || CRM_Utils_Array::value('billing_mode', $processor) == 4) {
return;
}
//@todo setPaymentFields defines the billing fields - this should be moved to the processor class & renamed getBillingFields
// potentially pay later would also be a payment processor
//also set the billingFieldSet to hold all the details required to render the fieldset so we can iterate through the fieldset - making
// it easier to re-order in hooks etc. The billingFieldSets param is used to determine whether to show the billing pane
CRM_Core_Payment_Form::setBillingDetailsFields($form);
$form->billingFieldSets['billing_name_address-group']['fields'] = array();
}
示例2: hackyHandlePayLaterInPaymentProcessorFunction
/**
* Set billing fields for pay later.
*
* This is considered hacky because pay later has basically been cludged onto the payment processor form.
*
* See notes on the deprecated function as to how this could be restructured. Alternatively this pay later
* handling could be moved out of the payment processor form all together.
*
* @param CRM_Core_Form $form
* @param int $forceBillingFieldsForPayLater
*/
protected static function hackyHandlePayLaterInPaymentProcessorFunction(&$form, $forceBillingFieldsForPayLater)
{
if ($forceBillingFieldsForPayLater) {
CRM_Core_Payment_Form::setBillingDetailsFields($form);
$form->billingFieldSets['billing_name_address-group']['fields'] = array();
}
}