Example 3: Generate a Table List

In the administrative interface for your project or module, it may be necessary to create a page that lists the tables you have defined. These can be listed all at once or by the settings path. This example follows the previous example and lists all tables defined by enabled modules whose base settings path is set to 'tapirtest/example_2.' Notice this list has a link leading to the settings page for the modules along with a short description of the table. These come from the TAPIr hook_table_settings shown in the previous example. The table can be printed to any page on your Drupal site on a page with the Input format set to PHP using the following code:

print tapir_table_list('tapirtest/example_2');

This example also shows you how to create your own page in the module to display the table. It works in much the same way. You're just returning the output of the function instead of printing it. You also have to use Drupal's hook_menu to define the menu callback.

Example: view page


function tapirtest_menu($may_cache) {
  if (
$may_cache) {
$items[] = array(
'path' => 'tapirtest/example_3',
'title' => t('Example 3: Generate a Table List'),
'callback' => 'tapirtest_example_3',
'access' => user_access('access content'),
'type' => MENU_CALLBACK,


tapirtest_example_3() {
$output = '<p>'. tapir_table_list('tapirtest/example_2') .'</p>';