You are here

function commerce_shipping_ui_form_commerce_shipping_ui_add_calculation_rule_form_alter in Commerce Shipping 7.2

Implements hook_form_FORM_ID_alter().

The Shipping UI module instantiates the Rules Admin rule configuration add form at a particular path in the Commerce IA. It uses its own form ID to do so and alters the form here to select the necessary Rules event.

See also

rules_admin_add_reaction_rule()

File

./commerce_shipping_ui.module, line 254
Default Shipping UI for Drupal Commerce.

Code

function commerce_shipping_ui_form_commerce_shipping_ui_add_calculation_rule_form_alter(&$form, &$form_state) {
  unset($form['settings']['help']);
  $form['settings']['event']['#type'] = 'value';
  $form['settings']['event']['#value'] = 'commerce_shipping_calculate_rate';
  $form['submit']['#suffix'] = l(t('Cancel'), 'admin/commerce/config/shipping/calculation-rules');
}