Fix theme inclusion regression for themes that do not override templates

This commit is contained in:
Celestora 2021-12-12 16:08:38 +02:00
parent 7bb0535e87
commit d8b37366cb

View file

@ -221,13 +221,17 @@ abstract class OpenVKPresenter extends SimplePresenter
{ {
parent::onBeforeRender(); parent::onBeforeRender();
if(Session::i()->get("_tempTheme")) $theme = NULL;
if(Session::i()->get("_tempTheme")) {
$theme = Themepacks::i()[Session::i()->get("_tempTheme", "ovk")]; $theme = Themepacks::i()[Session::i()->get("_tempTheme", "ovk")];
else if($this->requestParam("themePreview")) Session::i()->set("_tempTheme", NULL);
} else if($this->requestParam("themePreview")) {
$theme = Themepacks::i()[$this->requestParam("themePreview")]; $theme = Themepacks::i()[$this->requestParam("themePreview")];
else if($this->user->identity !== null && $this->user->identity->getTheme()) } else if($this->user->identity !== null && $this->user->identity->getTheme()) {
$theme = $this->user->identity->getTheme(); $theme = $this->user->identity->getTheme();
}
$this->template->theme = $theme;
if(!is_null($theme) && $theme->overridesTemplates()) if(!is_null($theme) && $theme->overridesTemplates())
$this->template->_templatePath = $theme->getBaseDir() . "/tpl"; $this->template->_templatePath = $theme->getBaseDir() . "/tpl";