Installation Method
Module Development (Form Tools 3)
Your installation method takes a single parameter: the $module_id
, passed to it from the core code.
You don't have to use the value if you don't need it, but your method definition will need to include it. The
module ID is unique and is the primary key in the [prefix]modules
table.
The return value is important. It needs to be an array with two indexes. The first indicates whether the installation was successful or not. If it's set to false, Form Tools will halt the installation. The second parameter is what should be displayed to the user - this is either a success or error message, depending on the first parameter. Note: this second parameter does not need to be included for success messages. By default, a successfully installed module will automatically display a message informing the user of this with a "select this module" link. The second parameter, if included, will override this default message. So to rely on the default message, just pass an empty string as the second parameter, like so: