Merge remote-tracking branch 'origin/feature/8772_form_dependencies_manager' into feature/8772_form_dependencies_manager

This commit is contained in:
Benjamin Dalsass
2025-11-12 17:11:29 +01:00
3 changed files with 19 additions and 4 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;
}
}

View File

@@ -3,9 +3,13 @@
<turbo-stream action="update" target="turbo_itop_profiler">
<template>
{% for aProfileInfo in aProfilesInfo %}
{% set aProfileData = aProfileInfo.aProfileData %}
{{ include(aProfileInfo.sTemplate) }}
{% endfor %}
{% if aProfilesInfo is not empty %}
{% UIPanel Neutral { sTitle:'Debug' } %}
{% for aProfileInfo in aProfilesInfo %}
{% set aProfileData = aProfileInfo.aProfileData %}
{{ include(aProfileInfo.sTemplate) }}
{% endfor %}
{% EndUIPanel %}
{% endif %}
</template>
</turbo-stream>