Skip navigation
Help

uc_order_edit_form

6 uc_order.admin.inc uc_order_edit_form($form_state, $order)
7 uc_order.admin.inc uc_order_edit_form($form, &$form_state, $order)

Displays the order edit screen, constructed via hook_uc_order_pane().

See also

uc_order_edit_form_validate()

uc_order_edit_form_submit()

theme_uc_order_edit_form()

uc_order_edit_form_delete()

Related topics

2 string references to 'uc_order_edit_form'

File

ubercart/uc_order/uc_order.admin.inc, line 955
Order administration menu items.

Code

function uc_order_edit_form($form, &$form_state, $order) {
  if (isset($form_state['order'])) {
    $order = $form_state['order'];
  }
  else {
    $form_state['order'] = $order;
  }
  $form['#order'] = $order;
  $form['order_id'] = array(
    '#type' => 'hidden',
    '#value' => $order->order_id,
  );
  $form['order_uid'] = array(
    '#type' => 'hidden',
    '#value' => $order->uid,
  );

  $modified = isset($form_state['values']['order_modified']) ? $form_state['values']['order_modified'] : $order->modified;
  $form['order_modified'] = array(
    '#type' => 'hidden',
    '#value' => $modified,
  );

  $panes = _uc_order_pane_list('edit');
  foreach ($panes as $id => $pane) {
    if (in_array('edit', $pane['show'])) {
      $func = $pane['callback'];
      if (function_exists($func)) {
        $func('edit-form', $order, $form, $form_state);
      }
    }
  }

  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit-changes'] = array(
    '#type' => 'submit', 
    '#value' => t('Submit changes'), 
    '#attributes' => array('class' => array('save-button')),
  );

  if (uc_order_can_delete($order)) {
    $form['actions']['delete'] = array(
      '#type' => 'submit', 
      '#value' => t('Delete'), 
      '#submit' => array('uc_order_edit_form_delete'),
    );
  }

  field_attach_form('uc_order', $order, $form, $form_state);

  form_load_include($form_state, 'inc', 'uc_store', 'includes/uc_ajax_attach');
  $form['#process'][] = 'uc_ajax_process_form';

  return $form;
}