library.php
Module Development (Form Tools 2)
The library.php file has special meaning within a Form Tools module. It acts as the main hub for interactions with the core code.
- First, any PHP in this file is automatically imported by the ft_init_module_page() function.
- If any features of your module needs to be accessed outside of its own module folder (e.g. in one of the core Form Tools pages), the ft_include_modules() function - which is used throughout Form Tools to include one or more modules on a single page - expects to find all the core functionality in the library.php file. If it doesn't exist, it won't work.
- If you register one or more hooks, your hook function has to be defined in this file - or in a file that's included by the library.php file.
- This file may contain your "special" functions for installation, uninstallation and upgrading (see links below for more information on each).
Important! Please "namespace" your functions by giving them all a consistent prefix (like Form Tools does with it's ft_ function prefix). We recommend using the module folder - or an abbreviation - as the function prefix. It will ensure compatibility with the core code and other modules being included at the same time.
For more information on the following functions which should appear in this file, see the appropriate section.