Table Wizard API

Last modified: May 3, 2009 - 18:40

Source API

The Table Wizard itself supports adding existing tables to its list, and comes bundled with the module tw_import_delimited as an alternative source of data. Additional sources can be supported by implementing the following two hooks (look at tw_import_delimited.module for an example implementation):

hook_tw_form() - Construct and return a fieldset containing form controls prompting the user for any necessary information for identifying your source. The fieldset needs to include a submit button, and needs to have a unique name not matching any other active source (e.g., you should not use 'existing' or 'delimited', which would conflict with hooks already provided).

hook_tw_form_submit_($values) - When the submit button in your fieldset is clicked, the fieldset name is used to construct this hook name and call it, pass the form values for your fieldset. Return an array of tablenames you've created. Please note that you most likely will need to apply db_prefix_tables('{'.$tablename.'}')
(particularly if you've used db_create_table()) to be sure the tablename is properly saved in a prefixed environment.

 
 

Drupal is a registered trademark of Dries Buytaert.