You are here

function uc_order_state_list in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_order/uc_order.module \uc_order_state_list()
  2. 6.2 uc_order/uc_order.module \uc_order_state_list()

Returns 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_order_state_options in uc_order/uc_order.rules.inc
Options callback.
uc_order_state_data in uc_order/uc_order.module
Returns 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
Returns 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 1905

Code

function uc_order_state_list($scope = 'all', $sql = FALSE) {
  $states = array();
  foreach (module_invoke_all('uc_order_state') as $id => $state) {

    // Preserve backward compatibility for states with no key specified.
    if (is_numeric($id)) {
      $id = $state['id'];
    }
    else {
      $state['id'] = $id;
    }
    if ($scope == 'all' || $state['scope'] == $scope) {
      $states[$id] = $state;
    }
  }
  uasort($states, 'uc_weight_sort');
  return $sql ? array_keys($states) : $states;
}