summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/Exceptions/messages.txt4
-rw-r--r--framework/Web/UI/TThemeManager.php10
2 files changed, 11 insertions, 3 deletions
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt
index 60b57d78..230789e7 100644
--- a/framework/Exceptions/messages.txt
+++ b/framework/Exceptions/messages.txt
@@ -143,7 +143,9 @@ authmanager_usermanager_invalid = TAuthManager.UserManager '{0}' does not refe
authmanager_usermanager_unchangeable = TAuthManager.UserManager cannot be modified after the module is initialized.
authmanager_session_required = TAuthManager requires a session application module.
-thememanager_basepath_invalid = TThemeManager.BasePath '{0}' is not a valid directory.
+thememanager_service_unavailable = TThemeManager requires TPageService to be available. This error often occurs when you configure TThemeManager outside of the page service configuration.
+thememanager_basepath_invalid = TThemeManager.BasePath '{0}' is not a valid path alias. Make sure you have defined this alias in configuration and it points to a valid directory.
+thememanager_basepath_invalid2 = TThemeManager.BasePath '{0}' is not a valid directory.
thememanager_basepath_unchangeable = TThemeManager.BasePath cannot be modified after the module is initialized.
theme_baseurl_required = TThemeManager.BasePath is required. By default, a directory named 'themes' under the directory containing the application entry script is assumed.
diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php
index 66bfa8be..245f8049 100644
--- a/framework/Web/UI/TThemeManager.php
+++ b/framework/Web/UI/TThemeManager.php
@@ -10,6 +10,8 @@
* @package System.Web.UI
*/
+Prado::using('System.Web.Services.TPageService');
+
/**
* TThemeManager class
*
@@ -63,7 +65,11 @@ class TThemeManager extends TModule
public function init($config)
{
$this->_initialized=true;
- $this->getService()->setThemeManager($this);
+ $service=$this->getService();
+ if($service instanceof TPageService)
+ $service->setThemeManager($this);
+ else
+ throw new TConfigurationException('thememanager_service_unavailable');
}
/**
@@ -105,7 +111,7 @@ class TThemeManager extends TModule
{
$this->_basePath=dirname($this->getRequest()->getApplicationFilePath()).'/'.self::DEFAULT_BASEPATH;
if(($basePath=realpath($this->_basePath))===false || !is_dir($basePath))
- throw new TConfigurationException('thememanager_basepath_invalid',$this->_basePath);
+ throw new TConfigurationException('thememanager_basepath_invalid2',$this->_basePath);
$this->_basePath=$basePath;
}
return $this->_basePath;