Skip to content

Instantly share code, notes, and snippets.

Last active Mar 10, 2021
What would you like to do?
Add a an action button in the Prestashop admin page header toolbar
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
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