function uc_order_pane_customer in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_order/uc_order_order_pane.inc \uc_order_pane_customer()
- 6.2 uc_order/uc_order.order_pane.inc \uc_order_pane_customer()
Handles the "Customer Info" order pane.
1 string reference to 'uc_order_pane_customer'
- uc_order_uc_order_pane in uc_order/
uc_order.module - Implements hook_uc_order_pane().
File
- uc_order/
uc_order.order_pane.inc, line 130 - This file contains the callbacks for the default order panes supplied with Ubercart and their corresponding helper functions.
Code
function uc_order_pane_customer($op, $order, &$form = NULL, &$form_state = NULL) {
switch ($op) {
case 'view':
$build['uid'] = array(
'#markup' => t('Customer number: !user_link', array(
'!user_link' => $order->uid ? l($order->uid, 'user/' . $order->uid) : '0',
)),
);
$build['primary_email'] = array(
'#markup' => '<br />' . t('Primary e-mail:') . '<br />' . check_plain($order->primary_email),
);
return $build;
case 'edit-form':
$form['customer']['uid'] = array(
'#type' => 'hidden',
'#default_value' => $order->uid,
);
$form['customer']['uid_text'] = array(
'#type' => 'textfield',
'#title' => t('Customer number'),
'#default_value' => $order->uid,
'#maxlength' => 10,
'#size' => 10,
'#disabled' => TRUE,
);
$form['customer']['primary_email'] = array(
'#type' => 'textfield',
'#title' => t('E-mail address'),
'#default_value' => $order->primary_email,
'#maxlength' => 64,
'#size' => 32,
);
return $form;
case 'edit-theme':
$output = '<div class="order-pane-icons">';
$output .= ' <img src="' . base_path() . drupal_get_path('module', 'uc_store') . '/images/order_view.gif" alt="' . t('Search for an existing customer.') . '" ' . 'title="' . t('Search for an existing customer.') . '" onclick="load_customer_search();" />';
$output .= ' <img src="' . base_path() . drupal_get_path('module', 'uc_store') . '/images/menu_customers_small.gif" alt="' . t('Create a new customer.') . '" ' . 'title="' . t('Create a new customer.') . '" onclick="load_new_customer_form();" />';
$output .= '</div>';
$output .= '<div id="customer-select"></div>';
$output .= drupal_render($form['customer']);
return $output;
case 'edit-process':
$changes = array();
$changes['uid'] = $form_state['values']['uid'];
$changes['primary_email'] = $form_state['values']['primary_email'];
return $changes;
}
}