You are here

function payment_status_hierarchy in Payment 7

Returns a hierarchical representation of payment statuses.

Return value

array A possibly infinitely nested associative array. Keys are statuses and values are arrays of similar structure as this function's return value.

2 calls to payment_status_hierarchy()
payment_page_status in ./payment.ui.inc
Display a payment status overview.
payment_status_options in ./payment.ui.inc
Return payment statuses for use in form elements.

File

./payment.ui.inc, line 1071
The Payment user interface.

Code

function payment_status_hierarchy() {
  static $hierarchy = NULL;
  if (is_null($hierarchy)) {
    $parents = $children = array();
    $statuses_info = payment_statuses_info();
    uasort($statuses_info, 'payment_payment_status_sort_title');
    foreach ($statuses_info as $status_info) {
      $children[$status_info->parent][] = $status_info->status;
      if (!$status_info->parent) {
        $parents[] = $status_info->status;
      }
    }
    $hierarchy = _payment_status_hierarchy_level($parents, $children);
  }
  return $hierarchy;
}