/** * Adds handler for needed application/controller events * @param \yii\base\Application $app * @param \yii\base\Controller $controller * @return void */ public function subscribe($app, $controller) { $controller->on(Controller::EVENT_PRE_DECORATOR, function ($event) use($controller) { /** @var \app\modules\core\events\ViewEvent $event */ $this->decorate($controller, $event->viewFile, $event->params); }); }