alejob Posted August 24, 2023 Share Posted August 24, 2023 Cómo puedo cambiar el breadcrumb para que salga Módulos > nombre_del_módulo > Configuración y el Título en lugar de EInvoicingConfigurationController se muestre como Configuración, dónde debo hacer los cambios. Controlador: 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...
ventura Posted August 25, 2023 Share Posted August 25, 2023 Creo que FrameworkBundleAdminController no tiene un metodo especifico para manejar el breadcrumb, sería necesario accerlo con un archivo .twig especifico. El titulo lo puedes modificar añadiendo en el render 'layoutTitle' => $this->trans('Configuración', 'Modules.Mimodulo.Admin'), 1 Link to comment Share on other sites More sharing options...
alejob Posted August 25, 2023 Author Share Posted August 25, 2023 @ventura muchas gracias por la respuesta y talvez donde podría encontrar la información para los diferentes atributos que recibe el método render. Link to comment Share on other sites More sharing options...
ventura Posted August 25, 2023 Share Posted August 25, 2023 El método render viene definido por Symfony, es donde se establecen las variables que se van a utilizar en el archivo de twig de la plantilla indicada para el admin. El controller FrameworkBundleAdminController tiene establecidas algunas variables desde las que se puede acceder, o sobrescribir desde cualquier admin controller que lo extienda 1 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