This text traditionally depends on the outdated payment processor 'mode' concept. Since the 'right' text depends
on what the payment processor plans to do moving it out to the processor classes makes sense
We could also do the same with 'button'
$contribButton = ts('Make Contribution');
}
$this->assign('button', $contribButton);
+
+ $this->assign('continueText',
+ $this->getPaymentProcessorObject()->getText('contributionPageContinueText', [
+ 'is_payment_to_existing' => !empty($this->_ccid),
+ 'amount' => $this->_amount,
+ ]
+ )
+ );
+
$this->addButtons(array(
array(
'type' => 'next',
}
}
+
+ /**
+ * Get the payment processor object for the submission, returning the manual one for offline payments.
+ *
+ * @return CRM_Core_Payment
+ */
+ protected function getPaymentProcessorObject() {
+ if (!empty($this->_paymentProcessor)) {
+ return $this->_paymentProcessor['object'];
+ }
+ return new CRM_Core_Payment_Manual();
+ }
+
}
$gotText .= ' ' . ts('You will receive an email receipt for each recurring contribution.');
}
}
- break;
+ return $gotText;
+
+ case 'contributionPageContinueText':
+ if ($params['amount'] <= 0) {
+ return ts('To complete this transaction, click the <strong>Continue</strong> button below.');
+ }
+ if ($this->_paymentProcessor['billing_mode'] == 4) {
+ return ts('Click the <strong>Continue</strong> button to go to %1, where you will select your payment method and complete the contribution.', [$this->_paymentProcessor['payment_processor_type']]);
+ }
+ if ($params['is_payment_to_existing']) {
+ return ts('To complete this transaction, click the <strong>Make Payment</strong> button below.');
+ }
+ return ts('To complete your contribution, click the <strong>Continue</strong> button below.');
+
}
- return $gotText;
+ CRM_Core_Error::deprecatedFunctionWarning('Calls to getText must use a supported method');
+ return '';
}
/**
return TRUE;
}
+ /**
+ * Get help text information (help, description, etc.) about this payment,
+ * to display to the user.
+ *
+ * @param string $context
+ * Context of the text.
+ * Only explicitly supported contexts are handled without error.
+ * Currently supported:
+ * - contributionPageRecurringHelp (params: is_recur_installments, is_email_receipt)
+ *
+ * @param array $params
+ * Parameters for the field, context specific.
+ *
+ * @return string
+ */
+ public function getText($context, $params) {
+ switch ($context) {
+ case 'contributionPageContinueText':
+ if ($params['amount'] <= 0) {
+ return ts('To complete this transaction, click the <strong>Continue</strong> button below.');
+ }
+ return ts('To complete your contribution, click the <strong>Continue</strong> button below.');
+
+ }
+ }
+
}
<div class="crm-contribution-page-id-{$contributionPageID} crm-block crm-contribution-confirm-form-block">
<div class="help">
- <p>{ts}Please verify the information below carefully. Click<strong>Go Back</strong>if you need to make changes.{/ts}
- {if $contributeMode EQ 'notify' and ! $is_pay_later}
- {ts 1=$paymentProcessor.name 2=$button}Click the
- <strong>%2</strong>
- button to go to %1, where you will select your payment method and complete the contribution.{/ts}
- {elseif ! $is_monetary or $amount LE 0.0 or $is_pay_later}
- {ts 1=$button}To complete this transaction, click the<strong>%1</strong>button below.{/ts}
- {else}
- {ts 1=$button}To complete your contribution, click the<strong>%1</strong>button below.{/ts}
- {/if}
+ <p>{ts}Please verify the information below carefully. Click <strong>Go Back</strong> if you need to make changes.{/ts}
+ {$continueText}
</p>
</div>
<div id="crm-submit-buttons" class="crm-submit-buttons">