- Edited
Hello everyone,
I'm currently trying to create a plugin for OSTicket. Due to the fact that there's no official documentation or guide I'm following this one. It's a bit outdated, but most of it still seems to be correct. For me it doesn't work though, I'm currently stuck with the problem that I can't get my code to be called.
Creating a menu entry works, the link is correct. But when I click it, the signal below is not sent, so my callback function is not called, and the dispatcher doesn't handle the link in any way either. I don't quite understand how that is supposed to work, i.e. the signal and the dispatcher working together.
Beyond that, it seems like I need controllers to handle the different actions and requests. I'm also not sure how these are supposed to be set up.
Thanks in advance for any help.
- osTicket-Version: v1.12.5 (933bb1f) — Aktuell
- Server-Software: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.4.2
- MySQL-Version: 10.4.11
- PHP-Version: 7.4.2
Here are the relevant parts of the code:
class MyPlugin extends Plugin {
[...]
function bootstrap(){
$this->createStaffMenu();
// Call our function when signal is sent.
Signal::connect ( 'apps.scp', array (
'MyPlugin',
'callbackDispatch'
));
}
function createStaffMenu() {
Application::registerStaffApp ( 'My Plugin', 'apps/dispatcher.php/myplugin', array (
iconclass => 'faq-categories'
) );
}
[...]
static public function callbackDispatch($object, $data) {
error_log("callbackDispatch()"); // This point is never reached.
// URL routing stuff...
}
[...]