Skip to content

Commit

Permalink
BlockMacros: check when dynamic snippet is combined with id attribute [
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 3, 2020
1 parent 393708e commit 9a457ac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 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 9a457ac

Please sign in to comment.