function hook_tapir_table_alter in Ubercart 7.3
Same name and namespace in other branches
- 6.2 docs/hooks.php \hook_tapir_table_alter()
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.
1 invocation of hook_tapir_table_alter()
- tapir_get_table in uc_store/
includes/ tapir.inc - Loads a table element for use in the Forms API or simply drupal_render().
File
- 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',
),
),
);
}
}
}