You are here

function _uc_line_item_list in Ubercart 7.3

Builds a list of line items defined in the enabled modules.

6 calls to _uc_line_item_list()
uc_order_load_line_items in uc_order/uc_order.module
Returns an array containing an order's line items ordered by weight.
uc_order_load_line_items_display in uc_order/uc_order.module
Returns an order's line items ordered by weight, prepared for display.
uc_order_pane_line_items in uc_order/uc_order.order_pane.inc
Handles the "Line Items" order pane.
uc_order_views_data in uc_order/views/uc_order.views.inc
Implements hook_views_data().
uc_taxes_form in uc_taxes/uc_taxes.admin.inc
Builds a form to add or edit a tax rate.

... See full list

File

uc_order/uc_order.line_item.inc, line 130
Contains the callbacks for the default line items for orders and the various functions that make line items work.

Code

function _uc_line_item_list($action = NULL) {
  static $items = array();
  if (count($items) > 0 && $action !== 'rebuild') {
    return $items;
  }
  $items = array();
  foreach (module_invoke_all('uc_line_item') as $id => $item) {

    // Preserve backward compatibility for methods with no key specified.
    if (is_numeric($id)) {
      $id = $item['id'];
    }

    // Set defaults.
    $item += array(
      'id' => $id,
      'enabled' => TRUE,
      'weight' => 1,
    );

    // Merge in any settings.
    $items[$id] = array_merge($item, array(
      'enabled' => variable_get('uc_li_' . $id . '_enabled', $item['enabled']),
      'weight' => variable_get('uc_li_' . $id . '_weight', $item['weight']),
    ));
  }
  drupal_alter('uc_line_item_data', $items);
  uasort($items, 'uc_weight_sort');
  return $items;
}