/** * New node is found. * @return bool */ public function nodeOpened(MacroNode $node) { list($begin, $end, $attr) = $this->macros[$node->name]; $node->isEmpty = !$end; if ($attr && $node->prefix === $node::PREFIX_NONE) { $node->isEmpty = TRUE; $this->compiler->setContext(Latte\Compiler::CONTEXT_DOUBLE_QUOTED_ATTR); $res = $this->compile($node, $attr); if ($res === FALSE) { return FALSE; } elseif (!$node->attrCode) { $node->attrCode = "<?php {$res} ?>"; } $this->compiler->setContext(NULL); } elseif ($begin) { $res = $this->compile($node, $begin); if ($res === FALSE) { return FALSE; } elseif (!$node->openingCode) { $node->openingCode = "<?php {$res} ?>"; } } elseif (!$end) { return FALSE; } }
/** * New node is found. * @return bool */ public function nodeOpened(MacroNode $node) { if ($this->macros[$node->name][2] && $node->htmlNode) { $node->isEmpty = TRUE; $this->compiler->setContext(Latte\Compiler::CONTEXT_DOUBLE_QUOTED); $res = $this->compile($node, $this->macros[$node->name][2]); $this->compiler->setContext(NULL); if (!$node->attrCode) { $node->attrCode = "<?php {$res} ?>"; } } else { $node->isEmpty = !isset($this->macros[$node->name][1]); $res = $this->compile($node, $this->macros[$node->name][0]); if (!$node->openingCode) { $node->openingCode = "<?php {$res} ?>"; } } return $res !== FALSE; }