mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 12:08:47 +02:00
Add UIBlocks to twig (changed UIContentBlock params)
This commit is contained in:
@@ -14,19 +14,24 @@ use Twig\Node\Node;
|
||||
|
||||
class UIContentBlockNode extends Node
|
||||
{
|
||||
public function __construct($sName, $sContainerClass, $oBody, $lineno = 0, $tag = null)
|
||||
public function __construct($oParams, $oBody, $lineno = 0, $tag = null)
|
||||
{
|
||||
parent::__construct(['body' => $oBody], ['name' => $sName, 'container_class' => $sContainerClass], $lineno, $tag);
|
||||
parent::__construct(['body' => $oBody], ['params' => $oParams], $lineno, $tag);
|
||||
}
|
||||
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$sBlockVar = UIBlockHelper::GetBlockVarName('oContentBlock');
|
||||
$sName = empty($this->getAttribute('name')) ? 'null' : "'".$this->getAttribute('name')."'";
|
||||
$sContainerClass = $this->getAttribute('container_class');
|
||||
$oParams = $this->getAttribute('params');
|
||||
|
||||
$compiler
|
||||
->addDebugInfo($this)
|
||||
->write("\${$sBlockVar} = new Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlock({$sName}, '{$sContainerClass}');\n")
|
||||
->write("\$aParams = ")
|
||||
->subcompile($oParams)
|
||||
->raw(";\n")
|
||||
->write("\$sId = \$aParams['id'] ?? null;\n")
|
||||
->write("\$sContainerClass = \$aParams['container_class'] ?? '';\n")
|
||||
->write("\${$sBlockVar} = new Combodo\\iTop\\Application\\UI\\Base\\Layout\\UIContentBlock(\$sId, \$sContainerClass);\n")
|
||||
->write(UIBlockHelper::AddToParentBlock($sBlockVar))
|
||||
->write(UIBlockHelper::PushParentBlock($sBlockVar))
|
||||
->subcompile($this->getNode('body'))
|
||||
|
||||
Reference in New Issue
Block a user