diff --git a/Views/View.php b/Views/View.php index 56b4dbdd2..2eda79f7c 100644 --- a/Views/View.php +++ b/Views/View.php @@ -77,7 +77,7 @@ class View extends ViewAbstract * @var null|string * @since 1.0.0 */ - protected ?string $theme = null; + public ?string $theme = null; /** * Module name. @@ -85,7 +85,7 @@ class View extends ViewAbstract * @var null|string * @since 1.0.0 */ - protected ?string $module = null; + public ?string $module = null; /** * Constructor. diff --git a/Views/ViewAbstract.php b/Views/ViewAbstract.php index b1104c6e7..80078b01f 100644 --- a/Views/ViewAbstract.php +++ b/Views/ViewAbstract.php @@ -32,7 +32,7 @@ abstract class ViewAbstract implements RenderableInterface * @var string * @since 1.0.0 */ - private const BASE_PATH = __DIR__ . '/../..'; + protected const BASE_PATH = __DIR__ . '/../..'; /** * Output is buffered @@ -261,6 +261,11 @@ abstract class ViewAbstract implements RenderableInterface * @since 1.0.0 */ public function render(...$data) : string + { + return $this->renderTemplate($this->template, ...$data); + } + + protected function renderTemplate(string $template, ...$data) : string { $ob = ''; @@ -269,7 +274,7 @@ abstract class ViewAbstract implements RenderableInterface \ob_start(); } - $path = $this->template; + $path = $template; if (!\is_file($path)) { return ''; }