Rimuovere possibilità di abilitazione del debug mode da backoffice PrestaShop

In PrestaShop 1.7.8.9, per  nascondere il tasto di abilitazione/disabilitazione DebugMode presente in “Parametri Avanzati” => “Prestazioni”, è necessario cambiare la funzione buildForm presente nel file src/PrestaShopBundle/Form/Admin/AdvancedeParameters/Performance/DebugModeType.php

DA

public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          ->add('disable_non_native_modules', SwitchType::class, [
              'required' => false,
              'label' => $this->trans('Disable non PrestaShop modules', 'Admin.Advparameters.Feature'),
              'help' => $this->trans('Enable or disable non PrestaShop Modules.', 'Admin.Advparameters.Feature'),
          ])
          ->add('disable_overrides', SwitchType::class, [
              'required' => false,
              'label' => $this->trans('Disable all overrides', 'Admin.Advparameters.Feature'),
              'help' => $this->trans('Enable or disable all classes and controllers overrides.', 'Admin.Advparameters.Feature'),
          ])
          ->add('debug_mode', SwitchType::class, [
              'required' => false,
              'label' => $this->trans('Debug mode', 'Admin.Advparameters.Feature'),
              'help' => $this->trans('Enable or disable debug mode.', 'Admin.Advparameters.Help'),
          ]);
    
  }

A

public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          ->add('disable_non_native_modules', SwitchType::class, [
              'required' => false,
              'label' => $this->trans('Disable non PrestaShop modules', 'Admin.Advparameters.Feature'),
              'help' => $this->trans('Enable or disable non PrestaShop Modules.', 'Admin.Advparameters.Feature'),
          ])
          ->add('disable_overrides', SwitchType::class, [
              'required' => false,
              'label' => $this->trans('Disable all overrides', 'Admin.Advparameters.Feature'),
              'help' => $this->trans('Enable or disable all classes and controllers overrides.', 'Admin.Advparameters.Feature'),
          ]);
    /*
          ->add('debug_mode', SwitchType::class, [
              'required' => false,
              'label' => $this->trans('Debug mode', 'Admin.Advparameters.Feature'),
              'help' => $this->trans('Enable or disable debug mode.', 'Admin.Advparameters.Help'),
          ]);
    */
  }

 

Per rimuovere il tasto anche dalla modalità di errore, è necessario modificare i seguenti file

src/PrestaShopBundle/Resources/views/Admin/Exception/error.html.twig

e

src/PrestaShopBundle/Resources/views/Admin/Exception/not_found.html.twig

commentando in entrambi i file le righe

{#                  <button class="btn btn-outline-secondary" type="submit">#}
{#                    {{ 'Enable debug mode'|trans({}, 'Admin.Actions') }}#}
{#                  </button>#}

 

 

 

PrestaShop

Comments are disabled.