You are here

function theme_uc_recurring_subscription_products in UC Recurring Payments and Subscriptions 6.2

Same name and namespace in other branches
  1. 7.2 modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc \theme_uc_recurring_subscription_products()

Add table drag effect to product commission table.

File

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

Code

function theme_uc_recurring_subscription_products($form) {
  $header = array(
    t('Name'),
    t('Assigned role(s)'),
    t('Trial'),
    t('Payment Options'),
    '',
  );
  drupal_add_tabledrag('recurring-subscription-products', 'order', 'sibling', 'product-weight');
  foreach (element_children($form) as $key) {

    // Add class to group weight fields for drag and drop.
    $form[$key]['weight']['#attributes']['class'] = 'product-weight';
    $row = array();
    $row[] = drupal_render($form[$key]['title']);
    $row[] = drupal_render($form[$key]['role']);
    $row[] = drupal_render($form[$key]['trial']);
    $row[] = drupal_render($form[$key]['interval']);
    $row[] = drupal_render($form[$key]['weight']);
    $row[] = drupal_render($form[$key]['operations']);
    $rows[] = array(
      'data' => $row,
      'class' => 'draggable',
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => l('Add new subscription', 'admin/store/subscriptions/create'),
        'colspan' => 5,
      ),
    );
  }
  $output = theme('table', $header, $rows, array(
    'id' => 'recurring-subscription-products',
  ));
  $output .= '<div><span class="default-option">' . t('default subscription option') . '</span></div>';
  $output .= drupal_render($form);
  return $output;
}