-
Notifications
You must be signed in to change notification settings - Fork 50
Table system
The table system makes it easy to display data in a row/column format. Tables are defined by implementing hook_table(). Modules can modify tables by implementing hook_table_alter(). To get the data structure for $table_id call crm_get_table($table_id). To get themed html for a table, call theme('table', $table) where $table is the table id or data structure.
To define a table with the id "foo", define a function foo_table($opts) which returns a Table System : Data Structure.
If you would like to modify a table defined by another module before it is rendered, you can implement hook_table_alter($table, $table_id, $opts). When any table is rendered, this function will be called, and the Table System : Data Structure and id will be passed as $table, and $table_id. You must return the altered $table.
To get the table structure for a table with id $table_id, call crm_get_table($table, $opts). You usually won't need to do this because you can use theme() in most cases.
To render a table, call theme('table', $table_id, $opts). $table_id should be a table id string, but could also be a Table System : Data Structure.