You are here

function theme_uc_object_attributes_form in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.admin.inc \theme_uc_object_attributes_form()
  2. 7.3 uc_attribute/uc_attribute.admin.inc \theme_uc_object_attributes_form()

Display the formatted attribute form.

File

uc_attribute/uc_attribute.module, line 843

Code

function theme_uc_object_attributes_form($form) {
  if ($form['view']['#value'] == 'overview') {
    $header = array(
      t('Remove'),
      t('Name'),
      t('Default'),
      t('Required'),
      t('Order'),
      t('Display'),
    );
    if (count(element_children($form['attributes'])) > 0) {
      foreach (element_children($form['attributes']) as $aid) {
        $rows[] = array(
          drupal_render($form['attributes'][$aid]['remove']),
          drupal_render($form['attributes'][$aid]['name']),
          drupal_render($form['attributes'][$aid]['option']),
          drupal_render($form['attributes'][$aid]['required']),
          drupal_render($form['attributes'][$aid]['ordering']),
          drupal_render($form['attributes'][$aid]['display']),
        );
      }
    }
    else {
      $rows[] = array(
        array(
          'data' => t('You must first <a href="!url">add attributes to this !type</a>.', array(
            '!url' => request_uri() . '/add',
            '!type' => $form['type']['#value'],
          )),
          'colspan' => 6,
        ),
      );
    }
    $output = theme('table', $header, $rows);
  }
  $output .= drupal_render($form);
  return $output;
}