You are here

function uc_coupon_form_uc_order_edit_form_alter in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 6 uc_coupon.module \uc_coupon_form_uc_order_edit_form_alter()

Implements hook_form_uc_order_edit_form_alter().

File

./uc_coupon.module, line 2257
Provides discount codes and gift certificates for Ubercart.

Code

function uc_coupon_form_uc_order_edit_form_alter(&$form, &$form_state) {
  $order = $form_state['order'];
  $line_items = $order->line_items;
  foreach ($line_items as $item) {

    // Coupon line items should be changed using the coupon order-edit pane.
    if ($item['type'] == 'coupon') {
      $form['line_items'][$item['line_item_id']]['title'] = array(
        '#markup' => check_plain($item['title']),
      );
      $form['line_items'][$item['line_item_id']]['remove']['#access'] = FALSE;
      $form['line_items'][$item['line_item_id']]['amount'] = array(
        '#theme' => 'uc_price',
        '#price' => $item['amount'],
      );
    }
  }
}