function theme_uc_recurring_subscription_products in UC Recurring Payments and Subscriptions 7.2
Same name and namespace in other branches
- 6.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 926 - Uc recurring subscription UI.
Code
function theme_uc_recurring_subscription_products($variables) {
$form = $variables['form'];
$header = array(
t('Name'),
t('Assigned role(s)'),
t('Trial'),
t('Payment Options'),
t('Order'),
t(''),
);
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'] = array(
'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' => array(
'draggable',
),
);
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => l('Add new subscription', 'admin/store/subscriptions/create'),
'colspan' => 6,
),
);
}
$output = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'recurring-subscription-products',
),
));
$output .= '<div><span class="default-option">' . t('default subscription option') . '</span></div>';
$output .= drupal_render_children($form);
return $output;
}