Skip to content

Commit

Permalink
[latte] BlockMacros: check when dynamic snippet is combined with id a…
Browse files Browse the repository at this point in the history
…ttribute [Closes nette/application#242]
  • Loading branch information
dg committed Jan 3, 2020
1 parent 1444925 commit 144501e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions latte/src/Latte/Macros/BlockMacros.php
Expand Up @@ -229,6 +229,10 @@ public function macroBlock(MacroNode $node, PhpWriter $writer)

} elseif (strpos($name, '$') !== false) { // dynamic block/snippet
if ($node->name === 'snippet') {
if ($node->prefix && isset($node->htmlNode->attrs[$this->snippetAttribute])) {
throw new CompileException("Cannot combine HTML attribute $this->snippetAttribute with n:snippet.");
}

for (
$parent = $node->parentNode;
$parent && !($parent->name === 'snippet' || $parent->name === 'snippetArea');
Expand Down

0 comments on commit 144501e

Please sign in to comment.