dev-master
9999999-devTheme manager for Yii2 (simple theme managment for Yii2)
MIT
The Requires
by Singrana
yii2 themes thememanager sinplatform
Theme manager for Yii2 (simple theme managment for Yii2)
Theme manager for Yii2, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist singrana/thememanager "*"
or add, (*4)
"singrana/thememanager": "*"
to the require section of your composer.json
file., (*5)
Change your application config, (*6)
'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:, (*7)
\Yii::$app->view->theme->changeTheme('themeName');
For dynamic create new theme:, (*8)
\Yii::$app->view->theme->createTheme('newTheme', [ 'pathMap' => [ '@app/views' => '@app/themes/admin/views', '@app/views/layouts' => '@app/themes/admin/layouts', ], ]);
and use new theme:, (*9)
\Yii::$app->view->theme->changeTheme('newTheme');
Theme manager for Yii2 (simple theme managment for Yii2)
MIT
yii2 themes thememanager sinplatform