You are here

function commerce_option_set_form_wrapper in Commerce Product Option 7

Form callback wrapper: create or edit a option set.

Parameters

$set_id: The machine-name of the option set being created or edited by this form or a full option set array.

See also

commerce_option_set_form()

File

./commerce_option.module, line 350

Code

function commerce_option_set_form_wrapper($set_id) {
  if (is_array($set_id)) {
    $option_set = $set_id;
  }
  else {
    $option_set = commerce_option_set_load($set_id);
  }

  // Add the breadcrumb for the form's location.
  commerce_option_breadcrumb(TRUE);

  // Return a message if the option set is not governed by the commerce option module.
  if (!empty($option_set['set_id']) && $option_set['module'] != 'commerce_option') {
    return t('This option set cannot be edited, because it is not defined by the Option module.');
  }

  // Include the forms file from the Product module.
  module_load_include('inc', 'commerce_option', 'includes/commerce_option_set.forms');
  return drupal_get_form('commerce_option_set_form', $option_set);
}