Community Documentation

Table Wizard API

Last updated May 3, 2009. Created by mikeryan on May 3, 2009.
Log in to edit this page.

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.

About this page

Drupal version
Drupal 6.x
Audience
Developers and coders
Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.