mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 13:58:54 +00:00
[feature/twig] A bit of cleanup in twig.php
PHPBB3-11598
This commit is contained in:
parent
4ee7fb1a9d
commit
ddaccaf63e
1 changed files with 14 additions and 11 deletions
|
@ -266,7 +266,7 @@ class phpbb_template_twig implements phpbb_template
|
||||||
}
|
}
|
||||||
|
|
||||||
$context = &$this->get_template_vars();
|
$context = &$this->get_template_vars();
|
||||||
$this->twig->display($this->filenames[$handle], $context);
|
$this->twig->display($this->get_filename_from_handle($handle), $context);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -324,20 +324,12 @@ class phpbb_template_twig implements phpbb_template
|
||||||
*/
|
*/
|
||||||
public function assign_display($handle, $template_var = '', $return_content = true)
|
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)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -448,4 +440,15 @@ class phpbb_template_twig implements phpbb_template
|
||||||
|
|
||||||
return $vars;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue