You are here

function theme_uc_pma_payment_method_table in Ubercart Payment Method Adjustments 7

Same name and namespace in other branches
  1. 6 uc_pma.module \theme_uc_pma_payment_method_table()

File

./uc_pma.module, line 173
This module hooks into a few different parts of Ubercart to allow store administrators to associate a fee or discount with payment methods.

Code

function theme_uc_pma_payment_method_table($variables) {
  $form = $variables['form'];
  drupal_add_tabledrag('uc-payment-methods', 'order', 'sibling', 'uc-payment-method-weight');
  $header = array(
    t('Payment method'),
    t('List position'),
    t('Adjustment'),
    t('Operations'),
  );
  $rows = array();
  foreach (element_children($form) as $method) {
    $row = array(
      drupal_render($form[$method]['uc_payment_method_' . $method . '_checkout']),
      drupal_render($form[$method]['uc_payment_method_' . $method . '_weight']),
      drupal_render($form[$method]['uc_payment_method_' . $method . '_adjustment']),
      drupal_render($form[$method]['settings']),
    );
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'uc-payment-methods',
    ),
  ));
}