public macroExtends ( |
||
$node | ||
$writer |
public function macroExtends(MacroNode $node, PhpWriter $writer)
{
$notation = $node->getNotation();
if ($node->modifiers) {
throw new CompileException("Modifiers are not allowed in {$notation}");
} elseif (!$node->args) {
throw new CompileException("Missing destination in {$notation}");
} elseif ($node->parentNode) {
throw new CompileException("{$notation} must be placed outside any macro.");
} elseif ($this->extends !== NULL) {
throw new CompileException("Multiple {$notation} declarations are not allowed.");
} elseif ($node->args === 'none') {
$this->extends = 'FALSE';
} else {
$this->extends = $writer->write('%node.word%node.args');
}
if (!$this->getCompiler()->isInHead()) {
trigger_error("{$notation} must be placed in template head.", E_USER_WARNING);
}
}
/** * @param \Latte\MacroNode $node * @param \Latte\PhpWriter $writer */ public function macroExtends(MacroNode $node, PhpWriter $writer) { $node->args = $this->pathResolver->expandPath($node->args, 'Resources/templates'); $node->tokenizer = new MacroTokens($node->args); $writer = new PhpWriter($node->tokenizer); return $this->blockMacros->macroExtends($node, $writer); }