src/controllers/BaseController.php
public function init()
    {
        parent::init();
        $this->on(FrontendController::EVENT_BEFORE_ACTION, function() {
            // switch layout to admin or developer-defined in params
            $this->layout = isset(Yii::$app->params['admin.layout'])
                ? Yii::$app->params['admin.layout']
                : '@app/views/layouts/main';

            // register frontend monster
            AdminBundle::register($this->view);

            return true;
        });
    }
public function init()
    {
        parent::init();
        $this->on(FrontendController::EVENT_BEFORE_ACTION, function() {
            // switch layout to admin or developer-defined in params
            $this->layout = isset(Yii::$app->params['admin.layout'])
                ? Yii::$app->params['admin.layout']
                : '@app/views/layouts/main';

            // register frontend monster
            AdminBundle::register($this->view);

            return true;
        });
    }
public function init ( ) { parent :: init ( ) ; $ this -> on ( FrontendController :: EVENT_BEFORE_ACTION , function ( ) { // switch layout to admin or developer-defined in params $ this -> layout = isset ( Yii :: $ app -> params [ 'admin.layout' ] ) ? Yii :: $ app -> params [ 'admin.layout' ] : '@app/views/layouts/main' ; // register frontend monster AdminBundle :: register ( $ this -> view ) ; return true ; } ) ; }
Overrides default init adding some additional stuff
Overrides default init adding some additional stuff