You are here

function uc_order_view in Ubercart 7.3

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

Displays the order view screen, constructed via hook_uc_order_pane().

1 string reference to 'uc_order_view'
uc_order_menu in uc_order/uc_order.module
Implements hook_menu().

File

uc_order/uc_order.module, line 1244

Code

function uc_order_view($order, $view_mode = 'full') {
  $order->content['#view_mode'] = $view_mode;

  // Build fields content.
  // In case of a multiple view, node_view_multiple() already ran the
  // 'prepare_view' step. An internal flag prevents the operation from running
  // twice.
  field_attach_prepare_view('uc_order', array(
    $order->order_id => $order,
  ), $view_mode);
  entity_prepare_view('uc_order', array(
    $order->order_id => $order,
  ));
  $order->content += field_attach_view('uc_order', $order, $view_mode);
  $panes = _uc_order_pane_list($view_mode);
  foreach ($panes as $pane) {
    if (in_array($view_mode, $pane['show'])) {
      $func = $pane['callback'];
      if (function_exists($func) && ($contents = $func($view_mode, $order)) != NULL) {
        $title = isset($pane['display title']) ? $pane['display title'] : $pane['title'];
        if ($title) {
          $title = array(
            '#markup' => $pane['title'] . ':',
            '#prefix' => '<div class="order-pane-title">',
            '#suffix' => '</div>',
          );
        }
        else {
          $title = array();
        }
        $order->content[$pane['id']] = array(
          '#prefix' => '<div class="order-pane ' . $pane['class'] . '" id="order-pane-' . $pane['id'] . '">',
          '#suffix' => '</div>',
        );
        $order->content[$pane['id']]['title'] = $title;
        $order->content[$pane['id']]['pane'] = $contents;
      }
    }
  }
  return $order->content;
}