You are here

function commerce_coupon_form_submit in Commerce Coupon 7

Same name and namespace in other branches
  1. 7.2 includes/commerce_coupon.admin.inc \commerce_coupon_form_submit()

Submit callback for commerce_coupon_form().

File

includes/commerce_coupon_ui.forms.inc, line 82
Commerce Coupon editing UI.

Code

function commerce_coupon_form_submit($form, &$form_state) {
  $commerce_coupon =& $form_state['commerce_coupon'];
  $commerce_coupon->is_active = $form_state['values']['is_active'];

  // Notify field widgets.
  field_attach_submit('commerce_coupon', $commerce_coupon, $form, $form_state);

  // Save the coupon.
  commerce_coupon_save($commerce_coupon);
  $form_state['redirect'] = 'admin/commerce/coupons';

  // Redirect based on the button clicked.
  drupal_set_message(t('Coupon saved.'));
}