You are here

function theme_uc_shipping_new_shipment in Ubercart 7.3

Same name and namespace in other branches
  1. 5 shipping/uc_shipping/uc_shipping.module \theme_uc_shipping_new_shipment()
  2. 6.2 shipping/uc_shipping/uc_shipping.admin.inc \theme_uc_shipping_new_shipment()

Formats and displays the new shipment form.

See also

uc_shipping_new_shipment()

File

shipping/uc_shipping/uc_shipping.admin.inc, line 633
Shipping administration menu items.

Code

function theme_uc_shipping_new_shipment($variables) {
  $form = $variables['form'];
  drupal_add_js('misc/tableselect.js');
  $output = '';
  $header = array(
    array(
      'class' => array(
        'select-all',
      ),
    ),
    t('Package'),
    t('Products'),
    t('Weight'),
  );
  foreach (element_children($form['shipping_types']) as $shipping_type) {
    $rows = array();
    foreach (element_children($form['shipping_types'][$shipping_type]['packages']) as $package_id) {
      $row = array();
      $row[] = drupal_render($form['shipping_types'][$shipping_type]['packages'][$package_id]['checked']);
      $row[] = drupal_render($form['shipping_types'][$shipping_type]['packages'][$package_id]['package_id']);
      $row[] = drupal_render($form['shipping_types'][$shipping_type]['packages'][$package_id]['products']);
      $row[] = drupal_render($form['shipping_types'][$shipping_type]['packages'][$package_id]['weight']);
      $rows[] = $row;
    }
    if (count($rows)) {
      $form['shipping_types'][$shipping_type]['packages']['table'] = array(
        '#theme' => 'table',
        '#header' => $header,
        '#rows' => $rows,
      );
    }
  }
  $output .= drupal_render_children($form);
  return $output;
}