You are here

function uc_order_add_line_item_form in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_order/uc_order.module \uc_order_add_line_item_form()
  2. 6.2 uc_order/uc_order.admin.inc \uc_order_add_line_item_form()

Form to add a line item to an order.

See also

uc_order_add_line_item_form_validate()

uc_order_add_line_item_submit()

1 string reference to 'uc_order_add_line_item_form'
uc_order_menu in uc_order/uc_order.module
Implements hook_menu().

File

uc_order/uc_order.admin.inc, line 1157
Order administration menu items.

Code

function uc_order_add_line_item_form($form, &$form_state, $order, $line_item_id) {
  $func = _uc_line_item_data($line_item_id, 'callback');
  if (!function_exists($func) || ($form = $func('form', $order->order_id)) == NULL) {
    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Line item title'),
      '#description' => t('Display title of the line item.'),
      '#size' => 32,
      '#maxlength' => 128,
      '#default_value' => _uc_line_item_data($line_item_id, 'title'),
    );
    $form['amount'] = array(
      '#type' => 'uc_price',
      '#title' => t('Line item amount'),
      '#allow_negative' => TRUE,
    );
  }
  $form['order_id'] = array(
    '#type' => 'hidden',
    '#value' => $order->order_id,
  );
  $form['line_item_id'] = array(
    '#type' => 'hidden',
    '#value' => $line_item_id,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add line item'),
    '#suffix' => l(t('Cancel'), 'admin/store/orders/' . $order->order_id . '/edit'),
  );
  return $form;
}