function uc_order_workflow_form in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.admin.inc \uc_order_workflow_form()
- 7.3 uc_order/uc_order.admin.inc \uc_order_workflow_form()
1 string reference to 'uc_order_workflow_form'
- uc_order_menu in uc_order/
uc_order.module - Implementation of hook_menu().
File
- uc_order/
uc_order.module, line 771
Code
function uc_order_workflow_form() {
$states = uc_order_state_list();
$statuses = uc_order_status_list();
$form['order_states'] = array(
'#type' => 'fieldset',
'#title' => t('Order states'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#theme' => 'uc_order_state_table',
'#tree' => TRUE,
);
foreach ($states as $state) {
$form['order_states'][$state['id']]['title'] = array(
'#value' => $state['title'],
);
// Create the select box for specifying a default status per order state.
$options = array();
foreach ($statuses as $status) {
if ($status['state'] == $state['id']) {
$options[$status['id']] = $status['title'];
}
}
if (empty($options)) {
$form['order_states'][$state['id']]['default'] = array(
'#value' => t('- N/A -'),
);
}
else {
$form['order_states'][$state['id']]['default'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => uc_order_state_default($state['id']),
);
}
}
$form['order_statuses'] = array(
'#type' => 'fieldset',
'#title' => t('Order statuses'),
'#collapsible' => FALSE,
'#theme' => 'uc_order_status_table',
'#tree' => TRUE,
);
// Build the state option array for the order status table.
$options = array();
foreach ($states as $state) {
$options[$state['id']] = $state['title'];
}
foreach ($statuses as $status) {
$form['order_statuses'][$status['id']]['id'] = array(
'#value' => $status['id'],
);
$form['order_statuses'][$status['id']]['title'] = array(
'#type' => 'textfield',
'#default_value' => $status['title'],
'#size' => 32,
'#required' => TRUE,
);
$form['order_statuses'][$status['id']]['weight'] = array(
'#type' => 'weight',
'#delta' => 20,
'#default_value' => $status['weight'],
);
if ($status['locked']) {
$form['order_statuses'][$status['id']]['state'] = array(
'#value' => uc_order_state_data($status['state'], 'title'),
);
$form['order_statuses'][$status['id']]['locked'] = array(
'#type' => 'hidden',
'#value' => TRUE,
);
}
else {
$form['order_statuses'][$status['id']]['state'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => $status['state'],
);
$form['order_statuses'][$status['id']]['remove'] = array(
'#type' => 'checkbox',
);
}
}
$form['order_statuses']['create'] = array(
'#type' => 'submit',
'#value' => t('Create new status'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit changes'),
);
return $form;
}