aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/template/twig/twig.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php
index 717213ea1f..5fe8ba97f6 100644
--- a/phpBB/includes/template/twig/twig.php
+++ b/phpBB/includes/template/twig/twig.php
@@ -266,7 +266,7 @@ class phpbb_template_twig implements phpbb_template
}
$context = &$this->get_template_vars();
- $this->twig->display($this->filenames[$handle], $context);
+ $this->twig->display($this->get_filename_from_handle($handle), $context);
return true;
}
@@ -324,20 +324,12 @@ class phpbb_template_twig implements phpbb_template
*/
public function assign_display($handle, $template_var = '', $return_content = true)
{
- ob_start();
- $result = $this->display($handle);
- $contents = ob_get_clean();
- if ($result === false)
- {
- return false;
- }
-
if ($return_content)
{
- return $contents;
+ return $this->twig->render($this->get_filename_from_handle($handle));
}
- $this->assign_var($template_var, $contents);
+ $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle)));
return true;
}
@@ -448,4 +440,15 @@ class phpbb_template_twig implements phpbb_template
return $vars;
}
+
+ /**
+ * Get a filename from the handle
+ *
+ * @param string $handle
+ * @return string
+ */
+ protected function get_filename_from_handle($handle)
+ {
+ return (isset($this->filenames[$handle])) ? $this->filenames[$handle] : $handle;
+ }
}