N°3567 - Migrate backoffice pages to new UIBlock system : App. upgrade (remove UIHtml from twig)

This commit is contained in:
Eric
2021-01-19 17:24:09 +01:00
parent 01c4dff035
commit 6dd1807fca
7 changed files with 32 additions and 124 deletions

View File

@@ -38,7 +38,11 @@ class UIBlockNode extends Node
$oParams = $this->getAttribute('params');
$compiler
->addDebugInfo($this)
->write("\$aParams = ")
->write("\$sHtml = trim(ob_get_contents());\n")
->write("ob_end_clean();\n")
->write("if (strlen(\$sHtml) > 0) {\n")
->indent()->write("end(\$context['UIBlockParent'])->AddSubBlock(new \Combodo\iTop\Application\UI\Base\Component\Html\Html(\$sHtml));\n")->outdent()
->write("}\n") ->write("\$aParams = ")
->subcompile($oParams)
->raw(";\n");
@@ -107,8 +111,15 @@ class UIBlockNode extends Node
if ($oSubNode) {
$compiler
->write("array_push(\$context['UIBlockParent'], \${$sBlockVar});\n")
->write("ob_start();\n")
->subcompile($oSubNode)
->write("\$sHtml = trim(ob_get_contents());\n")
->write("ob_end_clean();\n")
->write("if (strlen(\$sHtml) > 0) {\n")
->indent()->write("end(\$context['UIBlockParent'])->AddSubBlock(new \Combodo\iTop\Application\UI\Base\Component\Html\Html(\$sHtml));\n")->outdent()
->write("}\n")
->write("array_pop(\$context['UIBlockParent']);\n");
}
$compiler->write("ob_start();\n");
}
}