Pass item in custom button controller #769
-
I feel this is mostly me missing some basic knowledge, but I'm struggling with this. I have created a view called cancelsubscription where I've added a custom button cancelSubscription that targets the controller function below. I know I should not echo anything in a controller, but it's just for testing - later it will update the database.
However, when I press the button, the view changes from view=cancelsubscription&id=1&Itemid=964 to &view=mysubscriptions&Itemid=964 and the id is lost. My question is: Why is the button creating this redirect when pressed, and how can I get the item object in the controller function? I've seen this tutorial, but it didn't help me: https://www.youtube.com/watch?v=X6vyExgjMkU |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Try: public function cancelSubscription() {
echo '<pre>'; print_r($this); echo '</pre>';exit;
} |
Beta Was this translation helpful? Give feedback.
-
Surely it's not the best solution, but a solution. I ended up writing to the Joomla session in my view.html.php file.
Then in my controller, I get the recordId using
I'm sure there is a better way, and something that is more elegant. Just don't know how. |
Beta Was this translation helpful? Give feedback.
Try: