You are here

function uc_product_class_form in Ubercart 5

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

Form builder for product classes.

See also

uc_product_class_form_submit

3 string references to 'uc_product_class_form'
uc_importer_import in uc_importer/uc_importer.module
Imports an XML document into the database.
uc_product_class_default in uc_product/uc_product.module
Display a list of product classes.
uc_product_menu in uc_product/uc_product.module
Implementation of hook_menu().

File

uc_product/uc_product.module, line 2147
The product module for Ubercart.

Code

function uc_product_class_form($pcid = null) {
  if ($pcid) {
    $class = uc_product_class_load($pcid);
    drupal_set_title(check_plain($class->name));
    $form['pcid'] = array(
      '#type' => 'hidden',
      '#value' => $pcid,
    );
  }
  else {
    $form['pcid'] = array(
      '#type' => 'textfield',
      '#title' => t('Class ID'),
      '#required' => true,
      '#max_length' => 32,
      '#description' => t('The machine-readable name of this content type. This text will be used for constructing the URL of the <em>create content</em> page for this content type. This name may consist only of lowercase letters, numbers, and underscores. Dashes are not allowed. Underscores will be converted into dashes when constructing the URL of the <em>create content</em> page. This name must be unique to this content type.'),
    );
  }
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Class name'),
    '#default_value' => $class->name,
    '#required' => true,
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#description' => t('This text describes the content type created for this product class to administrators.'),
    '#default_value' => $class->description,
  );
  $form['op'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}