You are here

function uc_product_class_default in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_class_default()
  2. 6.2 uc_product/uc_product.admin.inc \uc_product_class_default()

Displays a list of product classes.

1 string reference to 'uc_product_class_default'
uc_product_menu in uc_product/uc_product.module
Implements hook_menu().

File

uc_product/uc_product.admin.inc, line 11
Product administration menu items.

Code

function uc_product_class_default() {
  $classes = uc_product_class_load();
  $header = array(
    t('Class ID'),
    t('Name'),
    t('Description'),
    t('Operations'),
  );
  $rows = array();
  foreach ($classes as $class) {
    $ops = array(
      l(t('edit'), 'admin/store/products/classes/' . $class->pcid . '/edit'),
    );
    if (empty($class->locked)) {
      $ops[] = l(t('delete'), 'admin/store/products/classes/' . $class->pcid . '/delete');
    }
    $rows[] = array(
      check_plain($class->pcid),
      check_plain($class->name),
      filter_xss_admin($class->description),
      implode(' ', $ops),
    );
  }
  $build = array();
  $build['product_classes'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No product classes have been defined yet.'),
  );
  $build['header'] = array(
    '#markup' => '<h2>' . t('Add a class') . '</h2>',
  );
  $build['form'] = drupal_get_form('uc_product_class_form');
  return $build;
}