Trouble calling a plugin's controller function from within an event listener function I am working on extending the formbuilder2 plugin to call and pass the $event variable to a custom Controller after FormBuilder2 has initialized the "onBeforeSave" event within the FormBuilder2 Entry_Controller.

Background Info


Trying to extend the Formbuilder2 plugin
My plugin is called FormBuilder2ExtensionPlugin
Trying to call a Controller Function from within my FormBuilder2Extension_NotifyController and pass $event variables.
Within my FormBuilder2Extension_NotifyController, I am calling the actionNotifyAdmin($event) function.


My Plugin Logic:


FormBuilder2 Plugin saves entry and initializes the "onBeforeSave"
event.
FormBuilder2Extension Plugin listens for "onBeforeSave"
event, and triggers a custom controller function to run. Note: Must be
able to pass the $event variables to the new FormBuilder2Extension
controller function as well.
FormBuilder2Extension Controller will then parse $event data, and
run other FormBuilder2 Controller &amp; Service functions using the $data, so I will need to link from FormBuilder2Extension Controller functions to Formuilder2 Controller functions.


My Problem:


Cannot figure out how to run a Controller Function from within the init() event listener and pass the $event variables as well.


My Current Code: (within main plugin file)

 public function init()
   {
       parent::init();

       craft()-&gt;on('formBuilder2_entry.beforeSave', function(Event $event)
       {

         $url = UrlHelper::getActionUrl('formBuilder2Extension/notify/notifyAdmin', array('event' =&gt; $event));

         return;
       });
   }


Closing Remarks:

It works if I use a service function.

Example: craft()-&gt;formBuilder2Extension_notify-&gt;notifySubmitterOfSubmission($event);

But I would rather not rewrite the same Controller &amp; Service functions that formbuilder2 has already written and place it within my service folder.

Any thoughts…? Thanks!
You really, really shouldn't do this.

I'm not familiar with FormBuilder, but if it is well-built, its controllers will comprise thin methods calling services to do the grunt work; services which you can also call.

If there isn't a service method which does what you want (still assuming everything is well-architected), that means the author chose not to make that functionality part of FormBuilder's API, presumably for a good reason.

If FormBuilder isn't well-built, and instead shoves a load of code in its controllers, well, that's still not a reason for you to do something similarly ill-considered.