function uc_order_state_list in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_state_list()
- 7.3 uc_order/uc_order.module \uc_order_state_list()
Return a sorted list of the order states defined in the various modules.
Parameters
$scope: Specify the scope for the order states you want listed - all, general, or specific. States with a general scope are used on general lists and pages.
$sql: Pass this parameter as TRUE to alter the return value for a SQL query.
Return value
Either an array of state arrays or a string containing an array of state ids for use in a SQL query.
5 calls to uc_order_state_list()
- uc_order_condition_check_order_state_form in uc_order/
uc_order.ca.inc - uc_order_state_data in uc_order/
uc_order.module - Return a bit of data from a state array based on the state ID and array key.
- uc_order_status_create_form in uc_order/
uc_order.admin.inc - Presents the form to create a custom order status.
- uc_order_status_list in uc_order/
uc_order.module - Return a sorted list of order statuses, sortable by order state/scope.
- uc_order_workflow_form in uc_order/
uc_order.admin.inc - Displays the order workflow form for order state and status customization.
File
- uc_order/
uc_order.module, line 1731
Code
function uc_order_state_list($scope = 'all', $sql = FALSE) {
$states = module_invoke_all('order_state');
foreach ($states as $i => $value) {
if ($scope != 'all' && $states[$i]['scope'] != $scope) {
unset($states[$i]);
}
}
usort($states, 'uc_weight_sort');
if ($sql) {
foreach ($states as $state) {
$ids[] = $state['id'];
}
return "('" . implode("', '", $ids) . "')";
}
return $states;
}