You are here

function uc_product_class_form_validate in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 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 353
Product administration menu items.

Code

function uc_product_class_form_validate($form, &$form_state) {
  if ($form['pcid']['#type'] == 'textfield') {
    $type = node_type_get_type($form_state['values']['pcid']);
    if ($type) {
      if ($type->base == '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.'));
      }
    }
  }
}