Skip to content

Commit 720eeca

Browse files
committed
Fix InteractsWithTwigComponents not being able to render blocks when variable scope is limited
1 parent c67f5b7 commit 720eeca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/TwigComponent/src/Test/InteractsWithTwigComponents.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ protected function renderTwigComponent(string $name, array $data = [], ?string $
5151

5252
$template = \sprintf('{%% component "%s" with data %%}', addslashes($name));
5353

54-
foreach (array_keys($blocks) as $blockName) {
55-
$template .= \sprintf('{%% block %1$s %%}{{ blocks.%1$s|raw }}{%% endblock %%}', $blockName);
54+
foreach ($blocks as $blockName => $blockContent) {
55+
$template .= \sprintf('{%% block %1$s %%}%2$s{%% endblock %%}', $blockName, $blockContent);
5656
}
5757

5858
$template .= '{% endcomponent %}';

0 commit comments

Comments
 (0)