Skip to content
Snippets Groups Projects
Commit f530ef20 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fixes #4228

Closes #4228

Merge request studip/studip!3059
parent 96bca3ad
No related branches found
No related tags found
No related merge requests found
...@@ -17,20 +17,15 @@ class PhpTemplate extends Template ...@@ -17,20 +17,15 @@ class PhpTemplate extends Template
* @return string A string representing the rendered presentation. * @return string A string representing the rendered presentation.
* @throws TemplateNotFoundException * @throws TemplateNotFoundException
*/ */
public function _render(): string protected function _render(): string
{ {
extract($this->get_attributes()); extract($this->get_attributes());
# include template, parse it and get output # include template, parse it and get output
try { ob_start();
ob_start(); require $this->template;
require $this->template; $content_for_layout = ob_get_contents();
$content_for_layout = ob_get_contents(); ob_end_clean();
} catch (\Error $e) {
throw new TemplateNotFoundException(previous: $e);
} finally {
ob_end_clean();
}
# include layout, parse it and get output # include layout, parse it and get output
if (isset($this->layout)) { if (isset($this->layout)) {
......
...@@ -18,7 +18,7 @@ abstract class Template ...@@ -18,7 +18,7 @@ abstract class Template
* *
* @return string A string representing the rendered presentation. * @return string A string representing the rendered presentation.
*/ */
abstract public function _render(): string; abstract protected function _render(): string;
protected array $attributes = []; protected array $attributes = [];
protected Template|null $layout = null; protected Template|null $layout = null;
......
...@@ -108,7 +108,7 @@ final class FactoryTestCase extends \Codeception\Test\Unit ...@@ -108,7 +108,7 @@ final class FactoryTestCase extends \Codeception\Test\Unit
public function testShouldRespondToAddedHandlers() public function testShouldRespondToAddedHandlers()
{ {
$handler = new class('', $this->factory) extends Flexi\Template { $handler = new class('', $this->factory) extends Flexi\Template {
public function _render(): string protected function _render(): string
{ {
return ''; return '';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment