diff options
author | GODZilla0480@gmail.com <> | 2011-08-28 06:43:18 +0000 |
---|---|---|
committer | GODZilla0480@gmail.com <> | 2011-08-28 06:43:18 +0000 |
commit | 720b474005e2ad8483c669b300d40e10a7ed1cda (patch) | |
tree | caa999c43349bbacd6d4b58a41ef1253e640c60a | |
parent | fb494d1e299e256721cba77105a01b7480c48c08 (diff) |
Modify TThemeManager to allow custom subclassing of TTheme
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | framework/Web/UI/TThemeManager.php | 41 |
2 files changed, 34 insertions, 8 deletions
@@ -12,6 +12,7 @@ CHG: Remove TReflectionClass and all references since equals ReflectionClass (Yv CHG: Modifiy TTemplate::parseAttributes to allow definition of "HTML5 Custom Data Attributes (data-*)" e.g Attributes.data-custom-value="foobar" (Yves) EHN: Modify TActiveRecordConfig & TActiveRecordManager to allow custom subclassing of System.Data.ActiveRecord.TActiveRecordManager & System.Data.ActiveRecord.TActiveRecordGateway (Yves) EHN: Add methods quoteTableName, quoteColumnName, quoteColumnAlias to TDbMetaData & TDbConnection and add TDbConnection:getDbMetaData [TODO: customize TOracleMetaData] (Yves) +EHN: Modify TThemeManager to allow custom subclassing of TTheme (Yves) Version 3.1.9 June 3, 2011 BUG: Issue#280 - Documentation has been updated diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php index ba4fa81d..ca6f5d91 100644 --- a/framework/Web/UI/TThemeManager.php +++ b/framework/Web/UI/TThemeManager.php @@ -80,8 +80,7 @@ class TThemeManager extends TModule {
$themePath=$this->getBasePath().DIRECTORY_SEPARATOR.$name;
$themeUrl=rtrim($this->getBaseUrl(),'/').'/'.$name;
- return new TTheme($themePath,$themeUrl);
-
+ return Prado::createComponent($this->getThemeClass(), $themePath, $themeUrl);
}
/**
@@ -196,6 +195,17 @@ class TTheme extends TApplicationComponent implements ITheme * Extension name of skin files
*/
const SKIN_FILE_EXT='.skin';
+
+ /**
+ * default theme class
+ */
+ const DEFAULT_THEMECLASS = 'TTheme';
+
+ /**
+ * @var string
+ */
+ private $_themeClass=self::DEFAULT_THEMECLASS;
+
/**
* @var string theme path
*/
@@ -328,7 +338,7 @@ class TTheme extends TApplicationComponent implements ITheme return $this->_name;
}
- /**
+ /**
* @param string theme name
*/
protected function setName($value)
@@ -344,7 +354,7 @@ class TTheme extends TApplicationComponent implements ITheme return $this->_themeUrl;
}
- /**
+ /**
* @param string the URL to the theme folder
*/
protected function setBaseUrl($value)
@@ -360,14 +370,29 @@ class TTheme extends TApplicationComponent implements ITheme return $this->_themePath;
}
- /**
+ /**
* @param string tthe file path to the theme folder
*/
protected function setBasePath($value)
{
$this->_themePath=$value;
}
-
+
+ /**
+ * @param string|null $class Theme class name in namespace format
+ */
+ public function setThemeClass($class) {
+ $this->_themeClass = $class===null ? self::DEFAULT_THEMECLASS : (string)$class;
+
+ }
+
+ /**
+ * @return string Theme class name in namespace format. Defaults to {@link TThemeManager::DEFAULT_THEMECLASS DEFAULT_THEMECLASS}.
+ */
+ public function getThemeClass() {
+ return $this->_themeClass;
+ }
+
/**
* @return array list of skins for the theme
*/
@@ -376,7 +401,7 @@ class TTheme extends TApplicationComponent implements ITheme return $this->_skins;
}
- /**
+ /**
* @param array list of skins for the theme
*/
protected function setSkins($value)
@@ -465,7 +490,7 @@ class TTheme extends TApplicationComponent implements ITheme return $this->_cssFiles;
}
- /**
+ /**
* @param array list of CSS files (URL) in the theme
*/
protected function setStyleSheetFiles($value)
|