Skip to content

Singrana/thememanager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Theme manager

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');

About

Theme manager for Yii2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages