You are here

function uc_cart_cart_pane_list in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_cart/uc_cart.module \uc_cart_cart_pane_list()
  2. 7.3 uc_cart/uc_cart.module \uc_cart_cart_pane_list()

Gets all of the enabled, sorted cart panes.

Parameters

$items: The contents of the cart.

$action: If 'rebuild' is passed, the static pane cache is cleared.

2 calls to uc_cart_cart_pane_list()
uc_cart_cart_panes_form in uc_cart/uc_cart.admin.inc
Settings for panes on the cart page.
uc_cart_view in uc_cart/uc_cart.pages.inc
Displays the cart view page.

File

uc_cart/uc_cart.module, line 1672

Code

function uc_cart_cart_pane_list($items, $action = NULL) {
  static $panes;
  if (count($panes) > 0 && $action !== 'rebuild') {
    return $panes;
  }
  $panes = module_invoke_all('cart_pane', $items);
  if (!is_array($panes) || count($panes) == 0) {
    return array();
  }
  foreach ($panes as $i => $value) {
    $panes[$i]['enabled'] = variable_get('uc_cap_' . $panes[$i]['id'] . '_enabled', !isset($panes[$i]['enabled']) ? TRUE : $panes[$i]['enabled']);
    $panes[$i]['weight'] = variable_get('uc_cap_' . $panes[$i]['id'] . '_weight', !isset($panes[$i]['weight']) ? 0 : $panes[$i]['weight']);
  }

  // Allow other modules to alter the panes.
  drupal_alter('cart_pane', $panes, $items);
  usort($panes, 'uc_weight_sort');
  return $panes;
}