function uc_product_class_form in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_product/uc_product.module \uc_product_class_form()
- 7.3 uc_product/uc_product.admin.inc \uc_product_class_form()
Form builder for product classes.
See also
uc_product_class_form_validate()
uc_product_class_form_submit()
2 string references to 'uc_product_class_form'
- uc_product_class_default in uc_product/
uc_product.admin.inc - Displays a list of product classes.
- uc_product_menu in uc_product/
uc_product.module - Implements hook_menu().
File
- uc_product/
uc_product.admin.inc, line 547 - Product administration menu items.
Code
function uc_product_class_form($form_state, $class = NULL) {
if (!is_null($class)) {
$classname = $class->name;
$classdesc = $class->description;
drupal_set_title(check_plain($classname));
$form['pcid'] = array(
'#type' => 'hidden',
'#value' => $class->pcid,
);
}
else {
$classname = '';
$classdesc = '';
$form['pcid'] = array(
'#type' => 'textfield',
'#title' => t('Class ID'),
'#required' => TRUE,
'#maxlength' => 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'),
'#description' => t('The human-readable name of this content type as it should appear on the !create_content page. There are no character restrictions on this name.', array(
'!create_content' => l(t('Create content'), 'node/add'),
)),
'#default_value' => $classname,
'#required' => TRUE,
);
$form['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#description' => t('This text describes the content type to administrators.'),
'#default_value' => $classdesc,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}