Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Nette\Latte;
- use Nette\Latte\MacroNode;
- class UIMacros extends Latte\Macros\MacroSet
- {
- /**
- * @param Latte\Parser $parser
- */
- public static function install(Latte\Parser $parser)
- {
- $me = new static($parser);
- $me->addMacro('box', callback($me, 'macroBoxBegin'), "?>\n\t</div>\n</div>\n<?php");
- }
- /**
- * @param MacroNode $node
- * @param Latte\PhpWriter $writer
- */
- public function macroBoxBegin(MacroNode $node, $writer)
- {
- $title = $node->tokenizer->fetchWord();
- if (!$title) {
- throw new LatteException(); // dohledej si
- }
- $title = $writer->formatWord($title);
- // ...
- return $writer->write('?><div><?php');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment