You are here

public function UcOrderProductController::buildContent in Ubercart 7.3

Overrides EntityAPIController::buildContent().

Overrides EntityAPIController::buildContent

File

uc_order/uc_order.controller.inc, line 71
Contains controller classes for uc_order and uc_order_product entities.

Class

UcOrderProductController
Controller class for the uc_order_product entity.

Code

public function buildContent($product, $view_mode = 'full', $langcode = NULL, $content = array()) {
  $content['qty'] = array(
    '#theme' => 'uc_qty',
    '#qty' => $product->qty,
    '#cell_attributes' => array(
      'class' => array(
        'qty',
      ),
    ),
  );
  $node = node_load($product->nid);
  $title = node_access('view', $node) ? l($product->title, 'node/' . $node->nid) : check_plain($product->title);
  $content['product'] = array(
    '#markup' => $title . uc_product_get_description($product),
    '#cell_attributes' => array(
      'class' => array(
        'product',
      ),
    ),
  );
  $content['model'] = array(
    '#markup' => check_plain($product->model),
    '#cell_attributes' => array(
      'class' => array(
        'sku',
      ),
    ),
  );
  if (user_access('administer products')) {
    $content['cost'] = array(
      '#theme' => 'uc_price',
      '#price' => $product->cost,
      '#cell_attributes' => array(
        'class' => array(
          'cost',
        ),
      ),
    );
  }
  $content['price'] = array(
    '#theme' => 'uc_price',
    '#price' => $product->price,
    '#suffixes' => array(),
    '#cell_attributes' => array(
      'class' => array(
        'price',
      ),
    ),
  );
  $content['total'] = array(
    '#theme' => 'uc_price',
    '#price' => $product->price * $product->qty,
    '#suffixes' => array(),
    '#cell_attributes' => array(
      'class' => array(
        'total',
      ),
    ),
  );
  return parent::buildContent($product, $view_mode, $langcode, $content);
}