You are here

function uc_recurring_subscription_settings_form in UC Recurring Payments and Subscriptions 7.2

Same name and namespace in other branches
  1. 6.2 modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc \uc_recurring_subscription_settings_form()
1 string reference to 'uc_recurring_subscription_settings_form'
uc_recurring_subscription_menu in modules/uc_recurring_subscription/uc_recurring_subscription.module
Implements hook_menu().

File

modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc, line 844
Uc recurring subscription UI.

Code

function uc_recurring_subscription_settings_form($form, $form_state) {
  $form = array();
  $options = array();
  $result = db_query("SELECT * FROM {uc_product_classes}");
  foreach ($result as $class) {
    $options[$class->pcid] = $class->name;
  }
  $form['uc_recurring_subscription_product_class'] = array(
    '#type' => 'select',
    '#title' => 'Product Class',
    '#description' => 'Only products from this class will be managed as subscription.',
    '#options' => $options,
    '#default_value' => variable_get('uc_recurring_subscription_product_class', 'uc_recurring_subscription'),
  );
  $options = array();
  $attributes = uc_class_get_attributes(variable_get('uc_recurring_subscription_product_class', 'uc_recurring_subscription'));
  foreach ($attributes as $id => $value) {
    $options[$id] = $value->name;
  }
  $form['uc_recurring_subscription_attribute'] = array(
    '#type' => 'select',
    '#title' => 'Payment Attribute',
    '#description' => 'The attribute used to provide the payment options to users.',
    '#options' => $options,
    '#default_value' => variable_get('uc_recurring_subscription_attribute', ''),
  );
  return system_settings_form($form);
}