Permalink
Browse files

Added $templateFile to UI\Control

  • Loading branch information...
holantomas committed Dec 6, 2018
1 parent fc63a71 commit 9f0f3edc345fea85a672927dc60d853ae8654869
Showing with 28 additions and 1 deletion.
  1. +28 −1 src/Application/UI/Control.php
@@ -25,6 +25,9 @@
/** @var ITemplateFactory */
private $templateFactory;
/** @var string|null */
private $templateFile = null;
/** @var ITemplate */
private $template;
@@ -42,6 +45,24 @@
}
final public function setTemplateFile(string $templateFile = null)
{
$this->templateFile = $templateFile;
if ($this->template !== null) {
$this->template->setFile($templateFile);
}
return $this;
}
final public function getTemplateFile(): ?string
{
return $this->templateFile;
}
final public function getTemplate(): ITemplate
{
if ($this->template === null) {
@@ -54,7 +75,13 @@
protected function createTemplate(): ITemplate
{
$templateFactory = $this->templateFactory ?: $this->getPresenter()->getTemplateFactory();
return $templateFactory->createTemplate($this);
$template = $templateFactory->createTemplate($this);
if ($this->templateFile !== null) {
$template->setFile($this->templateFile);
}
return $template;
}

0 comments on commit 9f0f3ed

Please sign in to comment.