You are here

function commerce_backoffice_product_variation_type_form_wrapper in Commerce Backoffice 7

Form callback wrapper: create or edit a product variation type.

Parameters

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

1 string reference to 'commerce_backoffice_product_variation_type_form_wrapper'
commerce_backoffice_product_menu in ./commerce_backoffice_product.module
Implements hook_menu().

File

includes/commerce_backoffice_product.product_variation_types.inc, line 79
Product variation specific copy of commerce_product_ui/includes/commerce_product_ui.types.inc and commerce_product_ui/includes/commerce_product_ui.forms.inc.

Code

function commerce_backoffice_product_variation_type_form_wrapper($type) {
  if (!is_array($type)) {
    $type = commerce_product_type_load($type);
  }

  // Return a message if the product variation type is not governed by Product UI.
  if (!empty($type['type']) && $type['module'] != 'commerce_product_ui') {
    return t('This product variation 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', $type);
}