Page tree
Skip to end of metadata
Go to start of metadata

Creating a BMO Module

Create a file called Modulename.class.php in the root of your module directory.  In this example we're creating a Pony Module, and we're going to call it ponies

To start with, the file /var/www/html/admin/modules/ponies/Ponies.class.php must contain at least:

<?php
// Ensure you namespace your module. Failing to do so may lead to unexpected bugs.
namespace FreePBX\modules;
 
class Ponies implements \BMO {
    public function install() {}
    public function uninstall() {}
    public function backup() {}
    public function restore($backup) {}
	public function doConfigPageInit($page) {}
}

 

You also need to create a 'module.xml' file that contains the definition of the Module (See module.xml)

The 'FreePBX_Helpers' class is built in BMO.interface.php, and provides Autoloading of classes, the ability to use $this->getConfig() and $this->setConfig() - the new built in high-performance key/value store, and the management and mitigation of $_REQUEST responses. 

Note that this by itself is not useful at all, and will in fact cause an error to be displayed, because it doesn't contain the public function 'doConfigPageInit()', which, while is not required by the BMO interface, is required by the Hooks class. See the BMO Hooks page for more information.


 

  • No labels