Table Settings Pages

To allow the module to auto-generate a settings page for your table where users can configure the fields for the table, you must use TAPIr hook_table_settings. Here's the anatomy of an implementation of the hook for our above table:

function tapir_table_settings() {
$tables[] = array(
'id' => 'my_test_table',
'description' => 'A test of the TAPIr system!',



This hook is invoked a couple of different times and is used primarily to create dynamic menu items that lead to the settings form for each TAPIr defined table. When invoked, the hook is expected to return an array of table arrays that each include the following keys:

  • string id - The ID of the table; currently must be the name of the builder function.
  • string description - A one line description of the table used in table listing.
  • string path - Optional. The path (without a trailing slash) that will point to the settings page for this table. This defaults to admin/settings/tapir but may be set to anything. The full path for any table's settings page will be path/table_id. For example, this table's settings page can be reached at admin/settings/tapir/my_test_table.
  • string access - Optional. The permission needed to be able to access this table's settings page. This defaults to the TAPIr defined permission 'edit tables', but your module may define some other permission that you would like to use for granting access to the various tables.
  • string menu title - Optional. The text of the link to this table's settings page when displayed in the menu. This defaults to the table ID.
  • bool menu item - Optional. Force display of this table's settings on the menu. This defaults to FALSE. Forcing this is useful for creating menu items for your tables without cluttering up your module's hook_menu(), as the menu is created automatically by TAPIr.
  • bool preview - Optional. Whether or not to show a link to view the table from its settings page. This defaults to TRUE, but may be set to FALSE in the case of tables where a simple preview with no arguments would break the display.

Again, this list reflects the currently enabled keys, but we are open to ideas on expanding the offering. Current ideas include allowing the developer to force this table's settings page to show on the menu or restrict access by user role instead of just permission. It might also be handy to be able to define the other arguments to be passed to theme_table at build time in this array.