aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2013-07-01 11:52:03 -0500
committerNathaniel Guse <nathaniel.guse@gmail.com>2013-07-01 11:52:03 -0500
commitddaccaf63e8ae7ff5bd13b187fa40f3d089f02f0 (patch)
tree310e1992af18c059c3aefca51f96880f84be18a3
parent4ee7fb1a9d549ce0b1c687eaddbe0bf3261ab3bf (diff)
downloadforums-ddaccaf63e8ae7ff5bd13b187fa40f3d089f02f0.tar
forums-ddaccaf63e8ae7ff5bd13b187fa40f3d089f02f0.tar.gz
forums-ddaccaf63e8ae7ff5bd13b187fa40f3d089f02f0.tar.bz2
forums-ddaccaf63e8ae7ff5bd13b187fa40f3d089f02f0.tar.xz
forums-ddaccaf63e8ae7ff5bd13b187fa40f3d089f02f0.zip
[feature/twig] A bit of cleanup in twig.php
PHPBB3-11598
-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;
+ }
}