I found hook displayDashboardToolbarTopMenu in the header toolbar.
Here the hook in the main file of my module :
class Mymodule extends Module { [...] public function hookDisplayDashboardToolbarTopMenu($params) { $this->get('twig')->render('@Modules/'.$this->name.'/views/templates/admin/form/form_submit.html.twig', [ 'button' => $params['button'], ]); } } }
And mycontroller.php:
class LinkProductsToShop extends FrameworkBundleAdminController { public function someMethod() { // build a form here $formBuilder = $this->createFormBuilder($ps,[]) [...] $my_button = 'some button'; Hook::exec('hookDisplayDashboardToolbarTopMenu', [ 'button' => $my_button, ]); return $this->render('@Modules/mymodule/views/templates/admin/compare_products.html.twig', [ 'form' => $form->createView(), ]); } }
But seems the hook is executed before Hook:exec() is called. So $params['button'] is null. It should be $my_button.