I have a module which needs multiple Controllers. Every Controller though starts with an authentification check provided by a GET Parameter. So instead of writing in every controller at the beginning the same code I am thinking of a better way. What is best practice here?
I thought of using a Helper, which works for sharing code but in the Helper I would need to call $this->_request->getParams(); which I don't know if this is possible.
Any hints or tips?
-
Thats possible. Go for it. You can use it in a helper.– Kingshuk DebJun 2, 2017 at 14:12
-
But how do I get the request object into the Helper?– alobeejayJun 2, 2017 at 14:14
-
Try this. magento.stackexchange.com/questions/69540/…– Kingshuk DebJun 2, 2017 at 14:15
-
So do I set a constructor in my Helper/Data.php?– alobeejayJun 2, 2017 at 14:21
-
1Well, that was easy. Thank you @Kingshuk Deb– alobeejayJun 2, 2017 at 14:46
|
Show 1 more comment