I’m trying to find a way to add custom mass actions to my modules but I couldn’t find any resources on the documentation or in the forum, by looking at the code I found there is a hook “addmoremassaction” but I don’t understand how to use it, I would appreciate it a lot if I could get an example or an explanation
Hi Leonardo,
you have to use hooks:
- in the addMoreMassActions hook you can add the new item to the list
$hookmanager->resPrint .= '<option value="my_massaction">'.$langs->trans("MyMassAction").'</option>';
- then in doMassActions hook, insert the code to execute the action
if($_REQUEST["massaction"] == "my_massaction")
Marcello
1 Like
Thank you.
This worked for me with very little work on my part. When I executed this on my custom list page, it left my checkbox(es) checked. Which is ok, because I can work with that. But your code example answers what @Leonardo_Boss asked.