function uc_recurring_feature_form in UC Recurring Payments and Subscriptions 6
1 string reference to 'uc_recurring_feature_form'
- uc_recurring_product_feature in ./
uc_recurring.module - Implementation of hook_product_feature().
File
- ./
uc_recurring.module, line 467 - Allows you to add a recurring fee to a product/SKU to handle subscription type services.
Code
function uc_recurring_feature_form($form_state, $node, $feature) {
drupal_add_css(drupal_get_path('module', 'uc_recurring') . '/uc_recurring.css');
if (!empty($feature)) {
$fee = uc_recurring_fee_load('product', $feature['pfid']);
}
$options = uc_product_get_models($node);
$form['model'] = array(
'#type' => 'select',
'#title' => t('Applicable SKU'),
'#description' => t('Select the applicable product model/SKU for this fee.'),
'#options' => $options,
'#default_value' => $fee['model'],
);
$form['fee_amount'] = array(
'#type' => 'textfield',
'#title' => t('Recurring fee amount'),
'#description' => t('Charge this amount each billing period.<br />The product price is still charged at checkout.'),
'#default_value' => $fee['fee_amount'],
'#size' => 16,
'#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
'#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '',
);
$form['initial'] = array(
'#type' => 'fieldset',
'#title' => t('Initial charge'),
'#collapsible' => FALSE,
'#description' => t('Specify the time to wait to start charging the recurring fee after checkout. Remember the product price will be charged at the time of checkout.'),
'#attributes' => array(
'class' => 'interval-fieldset',
),
);
$form['initial']['initial_charge_value'] = array(
'#type' => 'select',
'#options' => drupal_map_assoc(uc_range(0, 52)),
'#default_value' => $fee['initial_charge_value'],
);
$form['initial']['initial_charge_unit'] = array(
'#type' => 'select',
'#options' => array(
'days' => t('day(s)'),
'weeks' => t('week(s)'),
'months' => t('month(s)'),
'years' => t('year(s)'),
),
'#default_value' => $fee['initial_charge_unit'],
);
$form['regular'] = array(
'#type' => 'fieldset',
'#title' => t('Regular interval'),
'#collapsible' => FALSE,
'#description' => t('Specify the length of the billing period for this fee.'),
'#attributes' => array(
'class' => 'interval-fieldset',
),
);
$form['regular']['regular_interval_value'] = array(
'#type' => 'select',
'#options' => drupal_map_assoc(uc_range(1, 52)),
'#default_value' => $fee['regular_interval_value'],
);
$form['regular']['regular_interval_unit'] = array(
'#type' => 'select',
'#options' => array(
'days' => t('day(s)'),
'weeks' => t('week(s)'),
'months' => t('month(s)'),
'years' => t('year(s)'),
),
'#default_value' => $fee['regular_interval_unit'],
);
$form['number_intervals'] = array(
'#type' => 'textfield',
'#title' => t('Number of billing periods'),
'#description' => t('Specify how many times the recurring fee will be charged.'),
'#size' => 16,
'#default_value' => $fee['number_intervals'],
'#required' => TRUE,
);
return uc_product_feature_form($form);
}