singrana / thememanager
Theme manager for Yii2 (simple theme managment for Yii2)
Package info
github.com/Singrana/thememanager
Type:yii2-extension
pkg:composer/singrana/thememanager
dev-master
2016-03-11 09:08 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2026-03-24 09:05:14 UTC
README
Theme manager for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist singrana/thememanager "*"
or add
"singrana/thememanager": "*"
to the require section of your composer.json file.
Usage
Change your application config
'view'=>
[
'theme' =>
[
'class' => 'singrana\thememanager\components\ThemeManager',
'current' => 'site',
'themes' =>
[
'site' =>
[
'pathMap' =>
[
'@app/views' => '@app/themes/site/views',
'@app/views/layouts' => '@app/themes/site/layouts',
],
'defaultLayout' => '//inner',
],
...
],
...
],
],
If you need to change theme, use:
\Yii::$app->view->theme->changeTheme('themeName');
For dynamic create new theme:
\Yii::$app->view->theme->createTheme('newTheme',
[
'pathMap' =>
[
'@app/views' => '@app/themes/admin/views',
'@app/views/layouts' => '@app/themes/admin/layouts',
],
]);
and use new theme:
\Yii::$app->view->theme->changeTheme('newTheme');