aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/template/twig/lexer.php10
-rw-r--r--phpBB/phpbb/template/twig/twig.php4
2 files changed, 7 insertions, 7 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index 4f88147542..606ca347ae 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -191,20 +191,20 @@ class phpbb_template_twig_lexer extends Twig_Lexer
// Recursive...fix any child nodes
$body = $parent_class->fix_begin_tokens($body, $parent_nodes);
- // Rename loopname vars (to prevent collisions, loop children are named (loop name)_loop_element)
- $body = str_replace($name . '.', $name . '_loop_element.', $body);
+ // Rename loopname vars
+ $body = str_replace($name . '.', $name . '.', $body);
// Need the parent variable name
array_pop($parent_nodes);
- $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '_loop_element.' : '';
+ $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '.' : '';
if ($subset !== '')
{
$subset = '|subset(' . $subset . ')';
}
- // Turn into a Twig for loop, using (loop name)_loop_element for each child
- return "{% for {$name}_loop_element in {$parent}{$name}{$subset} %}{$body}{% endfor %}";
+ // Turn into a Twig for loop
+ return "{% for {$name} in loops.{$parent}{$name}{$subset} %}{$body}{% endfor %}";
};
// Replace <!-- BEGINELSE --> correctly, only needs to be done once
diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php
index 92a37d1634..6cff1bb8e4 100644
--- a/phpBB/phpbb/template/twig/twig.php
+++ b/phpBB/phpbb/template/twig/twig.php
@@ -429,15 +429,15 @@ class phpbb_template_twig implements phpbb_template
$vars = array_merge(
$context_vars['.'][0], // To get normal vars
- $context_vars, // To get loops
array(
'definition' => new phpbb_template_twig_definition(),
'user' => $this->user,
+ 'loops' => $context_vars, // To get loops
)
);
// cleanup
- unset($vars['.']);
+ unset($vars['loops']['.']);
return $vars;
}