- To use this widget you should put the folder bootstrapupdatedialog in your directory with widgets. In my case it's common/widgets . If your widget directory differs - you should change namespaces in php files according to your widget directory path.
- In your view you should call render widget like that:
\common\widgets\bootstrapupdatedialog\BootstrapUpdateDialog::widget([
'view'=>$this,
'updateOptions'=>[
'updateLinks'=>'.translate',
'updateTitle'=>'Translate',
'gridSelector'=>'#projects'
]
]);
Your controller action will look like this:
public function actionCreate() {
$model = new ProjectImage();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
echo Json::encode([
'status'=>'success',
'content'=>\Yii::t('site','SUCCESS_CREATED'),
]);
} else {
echo Json::encode([
'status'=>'failure',
'content'=>$this->renderPartial('_form', ['model' => $model,]),
]);
}
\Yii::$app->end(200);
}