Skip navigation
Help

hook_tapir_table_alter

6 hooks.php hook_tapir_table_alter(&$table, $table_id)
7 uc_store.api.php hook_tapir_table_alter(&$table, $table_id)

Allows modules to alter the TAPIr table after the rows are populated.

The example below adds a value for the custom 'designer' column to the table rows. Each table row has a numeric key in $table and these keys can be accessed using element_children() from the Form API.

Parameters

$table: Table declaration containing header and populated rows.

$table_id: Table ID. Also the function called to build the table declaration.

Related topics

1 invocation of hook_tapir_table_alter()

File

ubercart/uc_store/uc_store.api.php, line 25
Hooks provided by the Store module.

Code

function hook_tapir_table_alter(&$table, $table_id) {
  if ($table_id == 'uc_product_table') {
    foreach (element_children($table) as $key) {
      $node = node_load($table['#parameters'][1][$key]);

      $table[$key]['designer'] = array(
        '#markup' => l($node->designer, 'collections/' . $node->designer_tid), 
        '#cell_attributes' => array('class' => array('designer')),
      );
    }
  }
}