XF 2.3 Use an action from a different controller and receive data

Newsman

Member
Hey there!

I'm working on a controller right now and inside one of the functions I want to send params to an action of a different controller (for example "actionFind") and receive the data in the first controller - how can I make this work?

(I do not want to copy an entire function over from one controller to the other)

Cheers!
 
Last edited:
There's a few approaches you could use but I suspect the most appropriate thing to do here would be to create a ControllerPlugin.

You will see these used and scattered around the code in various controllers. You can search for usages within either src/XF/Pub/Controller or src/XF/Admin/Controller for usages of $this->plugin( to see some examples.

The idea being you can move shared logic into a method inside a plugin class and it can be called from both controllers.
 
Back
Top Bottom