N°8772 - remove debug if not wanted like in config edition

This commit is contained in:
Eric Espie
2025-11-12 14:23:19 +01:00
parent 5af8adf7ce
commit 101b1b217e
2 changed files with 11 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ class ConfigEditorController extends Controller
public function __construct() {
parent::__construct(MODULESROOT.static::MODULE_NAME.'/templates', static::MODULE_NAME);
$this->SetDebugAllowed(false);
}
public function OperationEdit() : void

View File

@@ -107,6 +107,7 @@ abstract class Controller extends AbstractController
private CsrfTokenManager $oCsrfTokenManager;
private ?string $sContentType = null;
private ?string $sPageType = null;
private bool $bDebugAllowed = true;
/**
* Controller constructor.
@@ -1020,6 +1021,9 @@ abstract class Controller extends AbstractController
if (!in_array($sPageType, [self::ENUM_PAGE_TYPE_HTML, self::ENUM_PAGE_TYPE_AJAX, self::ENUM_PAGE_TYPE_TURBO_FORM_AJAX])) {
return;
}
if (!$this->bDebugAllowed) {
return;
}
$aProfilesInfo = [];
foreach (InterfaceDiscovery::GetInstance()->FindItopClasses(iProfilerExtension::class) as $sExtension) {
/** @var \Combodo\iTop\Application\TwigBase\Controller\iProfilerExtension $oExtensionInstance */
@@ -1087,4 +1091,10 @@ abstract class Controller extends AbstractController
$this->AddToPage($this->oTwig->render('application/forms/itop_error.html.twig', ['sControllerError' => $sErrorMsg]));
}
public function SetDebugAllowed(bool $bDebugAllowed): void
{
$this->bDebugAllowed = $bDebugAllowed;
}
}