You are here

function theme_uc_product_kit_items_form in Ubercart 7.3

Renders the list of kit components on the product kit edit form.

1 theme call to theme_uc_product_kit_items_form()
uc_product_kit_form in uc_product_kit/uc_product_kit.module
Implements hook_form().

File

uc_product_kit/uc_product_kit.theme.inc, line 13
Theme functions for the uc_product_kit module.

Code

function theme_uc_product_kit_items_form($variables) {
  $form =& $variables['form'];
  $header = array(
    t('Product'),
    t('Quantity'),
    t('List position'),
    t('Discount'),
  );
  $rows = array();
  foreach (element_children($form) as $item) {
    $row = array(
      drupal_render($form[$item]['link']),
      drupal_render($form[$item]['qty']),
      drupal_render($form[$item]['ordering']),
      drupal_render($form[$item]['discount']),
    );
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  if (empty($rows)) {
    return '';
  }
  drupal_add_tabledrag('uc-product-kit-item-table', 'order', 'sibling', 'uc-product-kit-item-ordering');
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'uc-product-kit-item-table',
    ),
  ));
  if (!empty($form['#description'])) {
    $output .= '<div class="description">' . $form['#description'] . "</div>\n";
  }
  return $output;
}