You are here

function commerce_product_ui_product_type_form_wrapper in Commerce Core 7

Form callback wrapper: create or edit a product type.

Parameters

$type: The machine-name of the product type being created or edited by this form or a full product type array.

See also

commerce_product_product_type_form()

1 string reference to 'commerce_product_ui_product_type_form_wrapper'
commerce_product_ui_menu in modules/product/commerce_product_ui.module
Implements hook_menu().

File

modules/product/includes/commerce_product_ui.types.inc, line 75

Code

function commerce_product_ui_product_type_form_wrapper($type) {
  if (is_array($type)) {
    $product_type = $type;
  }
  else {
    $product_type = commerce_product_type_load($type);
  }

  // Return a message if the product type is not governed by Product UI.
  if (!empty($product_type['type']) && $product_type['module'] != 'commerce_product_ui') {
    return t('This product type cannot be edited, because it is not defined by the Product UI module.');
  }

  // Include the forms file from the Product module.
  module_load_include('inc', 'commerce_product_ui', 'includes/commerce_product_ui.forms');
  return drupal_get_form('commerce_product_ui_product_type_form', $product_type);
}