alejob Posted August 24, 2023 Share Posted August 24, 2023 How can I change the breadcrumb to output Modules > module_name > Settings and the Title instead of EInvoicingConfigurationController to show as Settings, where should I make the changes. Controller: modules/acolitaxeinvoicing/src/Controller/EInvoicingConfigurationController.php <?php /** * Copyright since 2023 Acolitax® * * @author Acolitax <[email protected]> * @copyright Since 2023 Acolitax® */ declare(strict_types=1); namespace PrestaShop\Module\AcolitaxEInvoicing\Controller; use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class EInvoicingConfigurationController extends FrameworkBundleAdminController { public function index(Request $request): Response { $textFormDataHandler = $this->get('prestashop.module.acolitaxeinvoicing.form.einvoicing_settings_form_data_handler'); $configurationForm = $textFormDataHandler->getForm(); $configurationForm->handleRequest($request); if ($configurationForm->isSubmitted() && $configurationForm->isValid()) { /** You can return array of errors in form handler and they can be displayed to user with flashErrors */ $errors = $textFormDataHandler->save($configurationForm->getData()); if (empty($errors)) { $this->addFlash('success', $this->trans('Successful update.', 'Admin.Notifications.Success')); return $this->redirectToRoute('acolitax_einvoicing_configuration'); } $this->flashErrors($errors); } return $this->render('@Modules/acolitaxeinvoicing/views/templates/admin/form.html.twig', [ 'configurationForm' => $configurationForm->createView(), 'enableSidebar' => true, 'help_link' => $this->generateSidebarLink('EInvoicingConfigurationController'), ]); } } modules/acolitaxeinvoicing/acolitaxeinvoicing.php public function getContent(): string { $route = $this->get('router')->generate('acolitax_einvoicing_configuration'); Tools::redirectAdmin($route); } modules/acolitaxeinvoicing/config/routes.yml acolitax_einvoicing_configuration: path: /acolitaxeinvoicing/configuration methods: [GET, POST] defaults: _controller: PrestaShop\Module\AcolitaxEInvoicing\Controller\EInvoicingConfigurationController::index # Needed to work with tab system _legacy_controller: 'EInvoicingConfigurationController' _legacy_link: 'EInvoicingConfigurationController' Link to comment Share on other sites More sharing options...
Paul C Posted May 20 Share Posted May 20 It would have been useful if someone had answered this 😅 The page title is easy it gets added as a parameter [layoutTitle] in the render call: return $this->render('@Modules/acolitaxeinvoicing/views/templates/admin/form.html.twig', [ 'configurationForm' => $configurationForm->createView(), 'enableSidebar' => true, 'help_link' => $this->generateSidebarLink('EInvoicingConfigurationController'), 'layoutTitle' => $this->trans('A Superb Title', 'Admin.Navigation.Menu'), ]); Not found the breadcrumb yet but will try to remember to update this reply when/if I do! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now