...
The following methods are required to be implemented for each module, and a description of each.
getName()
The getName() method simply returns the name of the method. It's always best to define any language in your module using language files (see Translating Blesta for more information).
...
Code Block | ||
---|---|---|
| ||
class MyModule extends Module { ... public function moduleRowNamePlural() { return Language::_("MyModule.module_row_plural", true); } ... } |
moduleRowMetaKey()
This method returns a string identifying the module meta key value that is used to identify module rows. This is used to identify module rows from one another. For example, servers may be identified by their host name.
Code Block | ||
---|---|---|
| ||
class MyModule extends Module { ... public function moduleRowMetaKey() { return "host_name"; } ... } |
Optional Methods
The methods below are optional, but may be required to implement a module of any utility.
install/upgrade/uninstall()
The methods are invoked when the module is installed, upgraded, or uninstalled respectively.
Code Block | ||
---|---|---|
| ||
class MyModule extends Module {
...
public function install() {
// Perform install logic
}
public function upgrade($current_version) {
// Perform upgrade logic
}
public function uninstall($module_id, $last_instance) {
// Perform uninstall logic
if ($last_instance) {
// Delete all trace of this module
}
}
...
}
|
getLogo()
The getLogo() method returns the relative path (within the module's directory) to the logo used to represent the module. The default value is views/default/images/logo.png. This translates to /install_dir/components/modules/my_module/views/default/images/logo.png.
Code Block | ||
---|---|---|
| ||
class MyModule extends Module {
...
public function getLogo() {
return "some/path/to/my/logo.png";
}
...
}
|
validateService($package, array $vars=null)
addService($package, array $vars=null, $parent_package=null, $parent_service=null, $status="pending")
editService($package, $service, array $vars=array(), $parent_package=null, $parent_service=null)
cancelService($package, $service, $parent_package=null, $parent_service=null)
suspendService($package, $service, $parent_package=null, $parent_service=null)
unsuspendService($package, $service, $parent_package=null, $parent_service=null)
renewService($package, $service, $parent_package=null, $parent_service=null)
changeServicePackage($package_from, $package_to, $service, $parent_package=null, $parent_service=null)
addPackage(array $vars=null)
editPackage($package, array $vars=null)
deletePackage($package)
manageModule($module, array &$vars)
manageAddRow(array &$vars)
manageEditRow($module_row, array &$vars)
addModuleRow(array &$vars)
editModuleRow($module_row, array &$vars)
deleteModuleRow($module_row)
getGroupOrderOptions()
selectModuleRow($module_group_id)
getPackageFields($vars=null)
getEmailTags()
getAdminAddFields($package, $vars=null)
getClientAddFields($package, $vars=null)
getAdminEditFields($package, $vars=null)
getAdminServiceInfo($service, $package)
getClientServiceInfo($service, $package)
getAdminTabs($package)
getClientTabs($package)