isavon/yii2-quickstatus

The Quickstatus extension for the Yii2 Framework

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0 2022-07-11 16:08 UTC

This package is auto-updated.

Last update: 2025-06-11 22:28:22 UTC


README

yii2-quickstatus

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require isavon/yii2-quickstatus "@dev"

or add

"isavon/yii2-quickstatus": "@dev"

to the require section of your composer.json file.

Changes

NOTE: Refer the CHANGE LOG for details on changes to various releases.

Usage

Add QuickStatusAction to your controller.

public function actions()
{
    return [
        'active' => [
            'class'     => QuickStatusAction::className(),
            'modelName' => Model::className(),
        ],
        'hidden' => [
            'class'     => QuickStatusAction::className(),
            'modelName' => Model::className()
        ]
    ];
}

Add QuickStatusBehavior to your model.

public function behaviors()
{
    return [
        [
            'class' => QuickStatusBehavior::className(),
        ]
    ];
}

And add isavon\grid\ActionColumn with {active} {hidden} template to GriwView widget in your view file.

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        'id',
        'title',
        [
            'class' => 'isavon\grid\ActionColumn',
            'template' => '{active} {hidden} {update} {delete}',
            'visibleButtons' => [
                'hidden' => function ($model) {
                    return $model->status !== $model->statusHidden;
                },
                'active' => function ($model) {
                    return $model->status !== $model->statusActive;
                }
            ],
        ]
    ]
]) ?>

Done!