Is it possible to pass arguments to controller action methods, like

public function someAction($myArgument) { ... }

Or is using JInput the only way?

Edit: Using a URL like option=com_mycomponent&task=mycontroller.someaction&myargument=asd

  • Where are you calling it, from an URL, or another function? – Piero Marsilio Dec 13 '16 at 13:44
  • @PieroMarsilio From a URL – Olle Härstedt Dec 13 '16 at 13:44
  • well then I think only using JInput or a session variable previously stored. Maybe if you explain some more what do you want to achieve maybe we can help you out. – Piero Marsilio Dec 13 '16 at 13:48
  • Just looking for less idiosyncratic ways to do things than classic Joomla. ^^ – Olle Härstedt Dec 13 '16 at 13:53
  • You can override the execute method and add something like callBindedFunction at github.com/joomplace/JooYii/blob/master/Helper.php – Alexandr Jan 20 '17 at 6:37

No, there isn't a way to pass arguments into methods. Specifically, this has to do with how JControllerLegacy::execute() routes the request. So you're left with using the request or session to fetch your needed data.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.