-
-
Save adrienchretien/ec01f5e1612fbab6962027fce62b36bd to your computer and use it in GitHub Desktop.
Add a an action button in the Prestashop admin page header toolbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyModule\Controller; | |
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController; | |
class MyAdminController extends FrameworkBundleAdminController | |
{ | |
// … | |
public function indexAction() | |
{ | |
// Here you can override some variables from the /src/PrestaShopBundle/Resources/views/Admin/layout.html.twig | |
// template (layoutTitle, layoutHeaderToolbarBtn, layoutDisplayType, showContentHeader, headerTabContent, | |
// enableSidebar and help_link) by adding an associative array as second parameter of the render method. | |
// | |
// Seems to work from version 1.7.0.0. | |
return $this->render('@Modules/mymodule/templates/admin/add.html.twig',[ | |
'layoutHeaderToolbarBtn' => [ | |
'add' => [ | |
'href' => $this->generateUrl('admin_mymodule_add'), | |
'desc' => $this->trans('New block', 'Modules.MyModule.Admin'), | |
'icon' => 'add_circle_outline', | |
], | |
], | |
]); | |
} | |
// … | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment