mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 10:26:32 +00:00
Bugfix: When rendering blocks of other templates, don't pass the local blocks array.
This commit is contained in:
@@ -50,17 +50,17 @@ class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
|
||||
|
||||
$this
|
||||
->compileTemplateCall($compiler)
|
||||
->raw('->displayBlock(')
|
||||
->subcompile($this->getNode('name'))
|
||||
->raw(", \$context, \$blocks);\n")
|
||||
->raw('->displayBlock')
|
||||
;
|
||||
$this
|
||||
->compileBlockArguments($compiler)
|
||||
->raw(";\n");
|
||||
} else {
|
||||
$this
|
||||
->compileTemplateCall($compiler)
|
||||
->raw('->renderBlock(')
|
||||
->subcompile($this->getNode('name'))
|
||||
->raw(', $context, $blocks)')
|
||||
->raw('->renderBlock')
|
||||
;
|
||||
$this->compileBlockArguments($compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,4 +81,18 @@ class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
|
||||
->raw(')')
|
||||
;
|
||||
}
|
||||
|
||||
private function compileBlockArguments(Twig_Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->raw('(')
|
||||
->subcompile($this->getNode('name'))
|
||||
->raw(', $context');
|
||||
|
||||
if (!$this->hasNode('template')) {
|
||||
$compiler->raw(', $blocks');
|
||||
}
|
||||
|
||||
return $compiler->raw(')');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user