Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Calling a method in one controller from another
judgej
✭
Hopefully this is a simple question.
I have a plugin X with a handler that looks at comments after they have been saved (PostController_AfterDiscussionSave_Handler). Part of the functionality of that method is to call up a method that is created on the DiscussionController in another plugin (namely DiscussionController_Flag_Create).
In my plugin X I cannot seem to see the controller DiscussionController at all, let alone call up its "Flag" method.
What would be the normal way to handle this? Do I need to do something to tell Vanilla to load up the DiscussionController so I can invoke methods that are added to it by another plugin?
I just want to utilise some functionality built into a plugin to avoid having to duplicate it all in my plugin. I suspect I am overlooking something incredibly simple and obvious.
Thanks.
I have a plugin X with a handler that looks at comments after they have been saved (PostController_AfterDiscussionSave_Handler). Part of the functionality of that method is to call up a method that is created on the DiscussionController in another plugin (namely DiscussionController_Flag_Create).
In my plugin X I cannot seem to see the controller DiscussionController at all, let alone call up its "Flag" method.
What would be the normal way to handle this? Do I need to do something to tell Vanilla to load up the DiscussionController so I can invoke methods that are added to it by another plugin?
I just want to utilise some functionality built into a plugin to avoid having to duplicate it all in my plugin. I suspect I am overlooking something incredibly simple and obvious.
Thanks.
0
Comments
Is that the way it should work?
I think it is too easy to put code that belongs in the model, into the controller, so it probably gets done far too often; it gets the job done, but makes reuse of the functionality harder further on.