* Build Pledge Block in Contribution Pages.
*
* @param CRM_Core_Form $form
+ *
+ * @throws \CRM_Core_Exception
*/
public static function buildPledgeBlock($form) {
//build pledge payment fields.
if (empty($payments)) {
throw new CRM_Core_Exception(ts('Oops. It looks like there is no valid payment status for online payment.'));
}
- else {
- $form->assign('is_pledge_payment', TRUE);
- $form->addGroup($payments, 'pledge_amount', ts('Make Pledge Payment(s):'), '<br />');
- }
+ $form->addGroup($payments, 'pledge_amount', ts('Make Pledge Payment(s):'), '<br />');
}
else {
$form->addElement('text', 'pledge_installments', ts('Installments'), ['size' => 3, 'aria-label' => ts('Installments')]);
if (!empty($pledgeBlock['is_pledge_interval'])) {
- $form->assign('is_pledge_interval', CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock));
$form->addElement('text', 'pledge_frequency_interval', NULL, ['size' => 3, 'aria-label' => ts('Frequency Intervals')]);
}
else {
{if !$ccid}
{crmRegion name='contribution-main-pledge-block'}
{if $pledgeBlock}
- {if $is_pledge_payment}
+ {if array_key_exists('pledge_amount', $form)}
<div class="crm-public-form-item crm-section {$form.pledge_amount.name}-section">
<div class="label">{$form.pledge_amount.label} <span class="crm-marker">*</span></div>
<div class="content">{$form.pledge_amount.html}</div>
<div class="label"> </div>
<div class="content">
{$form.is_pledge.html}
- {if $is_pledge_interval}
+ {if array_key_exists('pledge_frequency_interval', $form)}
{$form.pledge_frequency_interval.html}
{/if}
{$form.pledge_frequency_unit.html}<span id="pledge_installments_num"> {ts}for{/ts} {$form.pledge_installments.html} {ts}installments.{/ts}</span>