zelenin / yii2-widgets
Yii2 widgets
Installs: 2 211
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2
This package is not auto-updated.
Last update: 2018-09-25 08:28:47 UTC
README
Yii2 widgets
Installation
Composer
The preferred way to install this extension is through Composer.
Either run
php composer.phar require zelenin/yii2-widgets "dev-master"
or add
"zelenin/yii2-widgets": "dev-master"
to the require section of your composer.json
Usage
Alert widget
Insert to create and update views:
echo Zelenin\yii\widgets\Alert::widget();
Add flashes in controller actions like:
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) {
Yii::$app->getSession()->setFlash('success', 'Updated');
return $this->redirect(['update', 'id' => $model->id]);
} else {
return $this->render('update', ['model' => $model]);
}
}
Error widget
Insert to create and update views:
echo Zelenin\yii\widgets\Error::widget(['model' => $model]);
Author
Aleksandr Zelenin, e-mail: aleksandr@zelenin.me