function commerce_order_ui_redirect_form in Commerce Core 7
Builds a form to redirect to an order's view page.
Parameters
$redirect_page: The page to redirect to, either 'admin', 'customer', or 'select' to add a widget to the form so the user can specify which page they want.
$identifier: The identifier to use to determine which order should be viewed; either 'order_number' (the default), 'order_id', or 'select'.
1 string reference to 'commerce_order_ui_redirect_form'
- commerce_order_ui_handler_area_view_order_form::render in modules/
order/ includes/ views/ handlers/ commerce_order_ui_handler_area_view_order_form.inc - Render the area.
File
- modules/
order/ commerce_order_ui.module, line 374
Code
function commerce_order_ui_redirect_form($form, &$form_state, $redirect_page = 'admin', $identifier = 'order_number') {
$form['#attached']['css'][] = drupal_get_path('module', 'commerce_order') . '/theme/commerce_order.admin.css';
if ($identifier == 'select') {
$form['identifier'] = array(
'#type' => 'select',
'#title' => t('Specify order by', array(), array(
'context' => 'a drupal commerce order',
)),
'#options' => array(
'order_number' => t('Order number', array(), array(
'context' => 'a drupal commerce order',
)),
'order_id' => t('Order ID', array(), array(
'context' => 'a drupal commerce order',
)),
),
'#default_value' => 'order_number',
);
$order_title = t('Order', array(), array(
'context' => 'a drupal commerce order',
));
}
else {
$form['identifier'] = array(
'#type' => 'value',
'#value' => $identifier,
);
if ($identifier == 'order_number') {
$order_title = t('Order number', array(), array(
'context' => 'a drupal commerce order',
));
}
else {
$order_title = t('Order ID', array(), array(
'context' => 'a drupal commerce order',
));
}
}
$form['order_identifier'] = array(
'#type' => 'textfield',
'#title' => $order_title,
'#size' => 16,
);
$form['order'] = array(
'#type' => 'value',
'#value' => NULL,
);
if ($redirect_page == 'select') {
$form['redirect_page'] = array(
'#type' => 'select',
'#title' => t('Redirect page'),
'#options' => array(
'admin' => t('Admin view page'),
'customer' => t('Customer view page'),
),
'#default_value' => 'admin',
);
}
else {
$form['redirect_page'] = array(
'#type' => 'value',
'#value' => $redirect_page,
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('View order'),
);
return $form;
}