mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/controller] Revert changes to template class
As per IRC, assign_display() effectively does what return_display() was added to do, so no change was needed. PHPBB3-10864
This commit is contained in:
parent
ef46af8298
commit
6900456e90
1 changed files with 559 additions and 580 deletions
|
@ -219,50 +219,29 @@ class phpbb_template
|
||||||
*
|
*
|
||||||
* @param string $handle Handle to operate on
|
* @param string $handle Handle to operate on
|
||||||
* @param string $template_var Template variable to assign compiled handle to
|
* @param string $template_var Template variable to assign compiled handle to
|
||||||
* @param bool $return_contents If true return compiled handle, otherwise assign to $template_var
|
* @param bool $return_content If true return compiled handle, otherwise assign to $template_var
|
||||||
* @return bool|string If $return_content is true return string of the compiled handle, otherwise return true
|
* @return bool|string false on failure, otherwise if $return_content is true return string of the compiled handle, otherwise return true
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function assign_display($handle, $template_var = '', $return_contents = true)
|
public function assign_display($handle, $template_var = '', $return_content = true)
|
||||||
{
|
|
||||||
$contents = $this->return_display($handle);
|
|
||||||
|
|
||||||
if (!$template_var && !$return_contents)
|
|
||||||
{
|
|
||||||
throw new RuntimeException($this->user->lang('TEMPLATE_CANNOT_BE_ASSIGNED'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($template_var)
|
|
||||||
{
|
|
||||||
$this->assign_var($template_var, $contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If !$return_content evaluates to true, true will be returned
|
|
||||||
// Otherwise, the value of $contents will be returned
|
|
||||||
return !$return_contents ?: $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the compiled template code as a string
|
|
||||||
*
|
|
||||||
* @param string $handle Handle to operate on
|
|
||||||
* @return string Compiled template code; can be output directly to page
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
public function return_display($handle)
|
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
$result = $this->display($handle);
|
$result = $this->display($handle);
|
||||||
$contents = ob_get_clean();
|
$contents = ob_get_clean();
|
||||||
|
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
{
|
{
|
||||||
throw new RuntimeException($user->lang('TEMPLATE_HANDLE_NOT_FOUND'));
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($return_content)
|
||||||
|
{
|
||||||
return $contents;
|
return $contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->assign_var($template_var, $contents);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains a template renderer for a template identified by specified
|
* Obtains a template renderer for a template identified by specified
|
||||||
* handle. The template renderer can display the template later.
|
* handle. The template renderer can display the template later.
|
||||||
|
|
Loading…
Add table
Reference in a new issue