Create a Plug in - ThomasDC84/Proteus GitHub Wiki
Create a Plug-in for Proteus
To create a plug-in for Proteus you must implement the SplObserver interface of PHP and understand the mechanism behind it.
Implementing the interface
There is only one method that you need to implement, it is called update and it has one parameter, the Plug-in manager. Inside this method you will have to call the $pluginManager->getHook() method and compare it to the hook where your code will work. The following snippet is a good starting point to write your plug-in:
class myPlugin implements \SplObserver { //rename myPlugin as you wish
public function update(\SplSubject $pluginManager) {
switch($pluginManager->getHook()) {
case FIRST_HOOK: /* Condition Here*/; {
//Your Code Here
} break;
case FEATURES_LOADED_HOOK: /* Condition Here*/; {
//Your Code Here
} break;
case CONTENTS_HOOK: /* Condition Here*/; {
//Your Code Here
} break;
case LAST_HOOK: /* Condition Here*/; {
//Your Code Here
} break;
default: ;
}
}
}
To know where is the exact location to put your code consult the Plug-in Manager Page