You are here

function commerce_tax_ui_tax_rate_add_form_wrapper in Commerce Core 7

Form callback wrapper: ensure tax types exist before going to the add form.

1 string reference to 'commerce_tax_ui_tax_rate_add_form_wrapper'
commerce_tax_ui_menu in modules/tax/commerce_tax_ui.module
Implements hook_menu().

File

modules/tax/includes/commerce_tax_ui.admin.inc, line 117
Administrative callbacks and form builder functions for the Tax UI module.

Code

function commerce_tax_ui_tax_rate_add_form_wrapper($tax_rate) {
  if (count(commerce_tax_type_titles()) == 0) {
    drupal_set_message(t('You must define at least one tax type before you can start adding tax rates.'), 'error');
    drupal_goto('admin/commerce/config/taxes/types');
  }
  return drupal_get_form('commerce_tax_ui_tax_rate_form', $tax_rate);
}