I know there are different ways to choose layout file. It can be done
Yii::$app->layout = \'...\'
One way could be to set the the layout file for the application in beforeAction
in each controller:
public function beforeAction($action) {
Yii::$app->layout = $this->layout;
return parent::beforeAction($action);
}
It could be optimized by putting this in an extra controller from which all other controllers inherit.
But I don't really like this solution. Seems to me like a workaround. Also this does not work if the SiteController defines a layout by itself (as $layout
property or within a method).