Latte\Macros\BlockMacros::macroImport PHP Method

macroImport() public method

{import "file"}
public macroImport ( MacroNode $node, PhpWriter $writer )
$node Latte\MacroNode
$writer Latte\PhpWriter
    public function macroImport(MacroNode $node, PhpWriter $writer)
    {
        if ($node->modifiers) {
            throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
        }
        $destination = $node->tokenizer->fetchWord();
        $this->checkExtraArgs($node);
        $code = $writer->write('$this->createTemplate(%word, $this->params, "import")->render();', $destination);
        if ($this->getCompiler()->isInHead()) {
            $this->imports[] = $code;
        } else {
            return $code;
        }
    }