zelenin/yii2-widgets Yii2 widgets

widgetsalerterror

Yii2 widgets

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

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



0.0.3 is the latest of 3 releases



MIT license
Stats
0 github stars & 0 github forks
0 downloads in the last day
56 downloads in the last 30 days
2176 total downloads