You are here

function uc_product_class_form_validate in Ubercart 6.2

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

Ensures the new product class is unique.

See also

uc_product_class_form()

uc_product_class_form_submit()

File

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

Code

function uc_product_class_form_validate($form, &$form_state) {
  if ($form['pcid']['#type'] == 'textfield') {
    $type = node_get_types('type', $form_state['values']['pcid']);
    if ($type) {
      if ($type->module == 'uc_product') {
        form_set_error('pcid', t('This product class already exists.'));
      }
      elseif ($type->custom == 0) {
        form_set_error('pcid', t('This is a node type provided by another module. Only custom node types may become product classes.'));
      }
    }
  }
}