Add a an action button in the Prestashop admin page header toolbar
<?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