You are here

function uc_coupon_recurring_form_uc_coupon_add_form_alter in Ubercart Discount Coupons 7.3

Implements hook_form_FORM_ID_alter() for the uc_coupon_add_form.

File

uc_coupon_recurring/uc_coupon_recurring.module, line 25
Discount coupon recurring payment integration.

Code

function uc_coupon_recurring_form_uc_coupon_add_form_alter(&$form, &$form_state) {
  $active = !empty($form['#uc_coupon']->data['recurring_payments']);
  $form['uc_coupon_recurring'] = array(
    '#type' => 'fieldset',
    '#title' => t('Recurring payment settings'),
    '#description' => t('Controls the way this coupon is applied to recurring payments.'),
    '#collapsible' => TRUE,
    '#collapsed' => !$active,
  );
  $form['uc_coupon_recurring']['recurring_payments'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum number of recurring payments to discount'),
    '#description' => t('Specify the maximum number of payments (after the initial order) to which the discount should be applied. Leave blank (or enter 0) to apply only to the initial order. Enter -1 to apply to all recurring payments. Please note this will be ignored if recurring payments are processed via Paypal WPS.'),
    '#default_value' => !empty($form['#uc_coupon']->data['recurring_payments']) ? $form['#uc_coupon']->data['recurring_payments'] : '',
  );
  $form['#entity_builders'][] = 'uc_coupon_recurring_build_coupon';
}