You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							38 lines
						
					
					
						
							947 B
						
					
					
				
			
		
		
	
	
							38 lines
						
					
					
						
							947 B
						
					
					
				| <?php | |
| /** | |
|  * Created by Error202 | |
|  * Date: 23.07.2018 | |
|  */ | |
|  | |
| namespace frontend\components; | |
|  | |
|  | |
| use yii\web\Cookie; | |
| use yii\base\Theme; | |
| use yii\web\Controller; | |
| use Yii; | |
|  | |
| class FrontendController extends Controller | |
| { | |
| 	public function init() { | |
| 		parent::init(); | |
|  | |
| 		// language | |
| 		$languages = ['ru', 'en']; | |
| 		$language = Yii::$app->request->get('language'); | |
| 		Yii::$app->language = $language && in_array($language, $languages) ? $language : Yii::$app->language; | |
|  | |
| 		// themes | |
| 		$theme = isset(Yii::$app->params['settings']['design']['theme']) ? Yii::$app->params['settings']['design']['theme'] : 'start'; | |
| 		Yii::$app->view->theme = new Theme([ | |
| 			'basePath' => '@webroot/themes/' . $theme, | |
| 			'baseUrl' => '@web/themes/' . $theme, | |
| 			'pathMap' => [ | |
| 				'@common/modules' => '@webroot/themes/' . $theme . '/modules', | |
| 				'@frontend/views' => '@webroot/themes/' . $theme, | |
| 				'@frontend/widgets' => '@webroot/themes/' . $theme . '/widgets', | |
| 			], | |
|  | |
| 		]); | |
| 	} | |
| } |