I am trying to make a module to add a table to a form in another module. I found I can add the new data in a module_form_alter hook but how to I get it to run through a theme hook? The module I am trying to modify has a theme hook for the page I want to modify. I don't want to change the original form I just want to add a table with new data below it. Thanks
+1
A:
Arrange your data into table headers and cell rows, and return the output with
return theme('table', $header, $rows, array('class' => 'ifyouwantaclassname'));
That will return data themed in a table. $rows are constructed by looping the dataset and adding an array item.
But you also need to change the structure of the form with a theme hook.
http://www.akchauhan.com/create-drupal-form-using-theme_table-like-module-list-form/
Has a pretty good write up on how to do it.
Kevin
2010-06-15 17:02:23
In what function do I put the returned theme since I am trying to add this to another modules form? Thanks
Kareed
2010-06-15 17:28:16
To alter a form implemented from a module, you need to implement `hook_form_alter()`, or `hook_form_FORM_ID_alter()` in another module.`hook_form_FORM_ID_alter()` is used when you know the ID of the form to alter.
kiamlaluno
2010-06-15 18:59:59