Commit 5b6e79dc by Qiang Xue

Fixes #3298: Supported configuring `View::theme` using a class name

parent f1742e5b
...@@ -35,6 +35,7 @@ Yii Framework 2 Change Log ...@@ -35,6 +35,7 @@ Yii Framework 2 Change Log
- Enh #3222: Added `useTablePrefix` option to the model generator for Gii (horizons2) - Enh #3222: Added `useTablePrefix` option to the model generator for Gii (horizons2)
- Enh #3230: Added `yii\filters\AccessControl::user` to support access control with different actors (qiangxue) - Enh #3230: Added `yii\filters\AccessControl::user` to support access control with different actors (qiangxue)
- Enh #3252: Added support for case insensitive matching using ILIKE to PostgreSQL QueryBuilder (cebe) - Enh #3252: Added support for case insensitive matching using ILIKE to PostgreSQL QueryBuilder (cebe)
- Enh #3298: Supported configuring `View::theme` using a class name (netyum, qiangxue)
- Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue) - Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue)
- Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue) - Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
- Enh: Added `yii\web\UrlManager::addRules()` to simplify adding new URL rules (qiangxue) - Enh: Added `yii\web\UrlManager::addRules()` to simplify adding new URL rules (qiangxue)
......
...@@ -72,7 +72,7 @@ class View extends Component ...@@ -72,7 +72,7 @@ class View extends Component
*/ */
public $defaultExtension = 'php'; public $defaultExtension = 'php';
/** /**
* @var Theme|array the theme object or the configuration array for creating the theme object. * @var Theme|array|string the theme object or the configuration for creating the theme object.
* If not set, it means theming is not enabled. * If not set, it means theming is not enabled.
*/ */
public $theme; public $theme;
...@@ -114,6 +114,8 @@ class View extends Component ...@@ -114,6 +114,8 @@ class View extends Component
$this->theme['class'] = 'yii\base\Theme'; $this->theme['class'] = 'yii\base\Theme';
} }
$this->theme = Yii::createObject($this->theme); $this->theme = Yii::createObject($this->theme);
} elseif (is_string($this->theme)) {
$this->theme = Yii::createObject($this->theme);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment