I have a change password bootstrap modal which will get triggered when the user clicks on the Change password navBar menu.
I have included the modal in the footer. But how can I pass the ChangePassword model instance
to the footer layout file?
Can beforeRender Or EVENT_BEFORE_RENDER
be used? If yes, How?
As suggested, I have put the following code in common/config/bootstrap.php:
yii\base\Event::on(yii\base\View::className(), yii\base\View::EVENT_BEFORE_RENDER, function() {
$modelChangePassword = new frontend\models\ChangePassword;
$this->view->params['modelChangePassword'] = $modelChangePassword;
});
But its giving Using $this when not in object context
error.