$form->assign('is_recur_interval', CRM_Utils_Array::value('is_recur_interval', $form->_values));
$form->assign('is_recur_installments', CRM_Utils_Array::value('is_recur_installments', $form->_values));
+ $form->assign('recurringHelpText', $form->_paymentObject->getText('contributionPageRecurringHelp', array(
+ 'is_recur_installments' => !empty($form->_values['is_recur_installments']),
+ 'is_email_receipt' => !empty($form->_values['is_email_receipt']),
+ )));
+
$form->add('checkbox', 'is_recur', ts('I want to contribute this amount'), NULL);
if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') {
return $this->_paymentForm;
}
+ /**
+ * 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) {
+ // I have deliberately added a noisy fail here.
+ // The function is intended to be extendable, but not by changes
+ // not documented clearly above.
+ switch ($context) {
+ case 'contributionPageRecurringHelp':
+ // require exactly two parameters
+ if (array_keys($params) == array('is_recur_installments', 'is_email_receipt')) {
+ $gotText = ts('Your recurring contribution will be processed automatically.');
+ if ($params['is_recur_installments']) {
+ $gotText .= ts(' You can specify the number of installments, or you can leave the number of installments blank if you want to make an open-ended commitment. In either case, you can choose to cancel at any time.');
+ }
+ if ($params['is_email_receipt']) {
+ $gotText .= ts(' You will receive an email receipt for each recurring contribution.');
+ }
+ }
+ break;
+ }
+ return $gotText;
+ }
+
/**
* Getter for accessing member vars.
*
</span>
{/if}
<div id="recurHelp" class="description">
- {ts}Your recurring contribution will be processed automatically.{/ts}
- {if $is_recur_installments}
- {ts}You can specify the number of installments, or you can leave the number of installments blank if you want to make an open-ended commitment. In either case, you can choose to cancel at any time.{/ts}
- {/if}
- {if $is_email_receipt}
- {ts}You will receive an email receipt for each recurring contribution.{/ts}
- {/if}
+ {$recurringHelpText}
</div>
</div>
<div class="clear"></div>