Add field to an entity_view for dispaly in a tapir table in ubercart In the simplest terms I am trying to add a 'vendor' column to the order view table in Ubercart which will display the author of each line item product.

Below is the table of interest.  I have hacked the direct code contained in uc_order.order_pane.inc but will refactor with hooks the drupal way ASAP. I have added my comments in the code below.

function uc_op_products_view_table($order) {
  dpm($order);
  $table = array(
    '#type' =&gt; 'tapir_table',
    '#attributes' =&gt; array('class' =&gt; array('order-pane-table')),
  );

  $table['#columns']['qty'] = array(
    'cell' =&gt; array(
      'data' =&gt; theme('uc_qty_label'),
      'class' =&gt; array('qty'),
    ),
    'weight' =&gt; 0,
  );
  $table['#columns']['product'] = array(
    'cell' =&gt; array(
      'data' =&gt; t('Product'),
      'class' =&gt; array('product'),
    ),
    'weight' =&gt; 1,
  );


Added by me:

  $table['#columns']['Vendor'] = array(
    'cell' =&gt; array(
      'data' =&gt; t('Vendor'),
      'class' =&gt; array('vendor'),
    ),
    'weight' =&gt; 1.5,
  );


.

  $table['#columns']['model'] = array(
    'cell' =&gt; array(
      'data' =&gt; t('SKU'),
      'class' =&gt; array('sku'),
    ),
    'weight' =&gt; 2,
  );
  if (user_access('administer products')) {
    $table['#columns']['cost'] = array(
      'cell' =&gt; array(
        'data' =&gt; t('Cost'),
        'class' =&gt; array('cost'),
      ),
      'weight' =&gt; 3,
    );
  }
  $table['#columns']['price'] = array(
    'cell' =&gt; array(
      'data' =&gt; t('Price'),
      'class' =&gt; array('price'),
    ),
    'weight' =&gt; 4,
  );
  $table['#columns']['total'] = array(
    'cell' =&gt; array(
      'data' =&gt; t('Total'),
      'class' =&gt; array('total'),
    ),
    'weight' =&gt; 5,
  );

  if (!empty($order-&gt;products)) {
    $build = entity_view('uc_order_product', $order-&gt;products);


This is the entity I want to edit. uc_order_product needs to have a field for Author / Vendor to make my table look right.

    dpm($build);
    $table['#rows'] = $build['uc_order_product'];
  }
  else {
    $table['#rows'][]['product'] = array(
      '#markup' =&gt; t('This order contains no products.'),
      '#cell_attributes' =&gt; array('colspan' =&gt; 'full'),
    );
  }

  return $table;
}
So this is the ugly hack I used to resolve the issue:

  if (!empty($order-&gt;products)) {
    $build = entity_view('uc_order_product', $order-&gt;products);
    foreach($build['uc_order_product'] as $line_item) {
      $node = node_load($line_item['#entity']-&gt;nid);
      $vendor['#markup'] = '&lt;a href=' . url('user/' . $node-&gt;uid) . '&gt;' . $node-&gt;uid . '&lt;/a&gt;';
      $vendor['#cell_attributes']['class'][] = 'vendor';
      $line_item_id = $line_item['#entity']-&gt;order_product_id;
      $build['uc_order_product'][$line_item_id]['vendor'] = $vendor;
    }
    $table['#rows'] = $build['uc_order_product'];
  }