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 716d032 commit bed0be3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Latte/Macros/BlockMacros.php
Expand Up @@ -226,6 +226,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['id'])) {
throw new CompileException('Cannot combine HTML attribute id with n:snippet.');
}

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

0 comments on commit bed0be3

Please sign in to comment.