public function nodeOpened(MacroNode $node)
{
list($begin, $end, $attr) = $this->macros[$node->name];
$node->empty = !$end;
if ($node->modifiers && (!$begin || is_string($begin) && strpos($begin, '%modify') === FALSE) && (!$end || is_string($end) && strpos($end, '%modify') === FALSE) && (!$attr || is_string($attr) && strpos($attr, '%modify') === FALSE)) {
throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
}
if ($node->args && (!$begin || is_string($begin) && strpos($begin, '%node') === FALSE) && (!$end || is_string($end) && strpos($end, '%node') === FALSE) && (!$attr || is_string($attr) && strpos($attr, '%node') === FALSE)) {
throw new CompileException('Arguments are not allowed in ' . $node->getNotation());
}
if ($attr && $node->prefix === $node::PREFIX_NONE) {
$node->empty = TRUE;
$node->context[1] = Latte\Compiler::CONTEXT_HTML_ATTRIBUTE;
$res = $this->compile($node, $attr);
if ($res === FALSE) {
return FALSE;
} elseif (!$node->attrCode) {
$node->attrCode = "<?php {$res} ?>";
}
$node->context[1] = Latte\Compiler::CONTEXT_HTML_TEXT;
} elseif ($begin) {
$res = $this->compile($node, $begin);
if ($res === FALSE || $node->empty && $node->prefix) {
return FALSE;
} elseif (!$node->openingCode && is_string($res) && $res !== '') {
$node->openingCode = "<?php {$res} ?>";
}
} elseif (!$end) {
return FALSE;
}
}