* zin: fix global to:xxx rendered twice times.

This commit is contained in:
sunhao
2024-03-01 16:16:59 +08:00
parent 5aa1e5471f
commit 9b7033212b
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ class directive implements iDirective
{
foreach($data as $blockName => $blockChildren)
{
$node->add($blockChildren, $blockName);
$node->addToBlock($blockName, $blockChildren);
}
}
}
+6
View File
@@ -291,6 +291,12 @@ class node implements \JsonSerializable
if($child instanceof node) $child->parent = $this;
if($child instanceof node)
{
if(isset($child->parent)) skipRenderInGlobal($child);
$child->parent = $this;
}
if($name === 'children' && $child instanceof node)
{
$blockName = static::getNameFromBlockMap($child->fullType());
+2 -2
View File
@@ -39,8 +39,8 @@ require_once __DIR__ . DS . 'jquery.class.php';
*/
function to(string $blockName, mixed ...$args): directive
{
$node = new node(...$args);
return directive('block', array($blockName => $node));
skipRenderInGlobal($args);
return directive('block', array($blockName => $args));
}
/**