PHP code example of yii2mod / yii2-editable

1. Go to this page and download the library: Download yii2mod/yii2-editable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yii2mod / yii2-editable example snippets


 [
    'class' => EditableColumn::class,
    'attribute' => 'username',
    'url' => ['change-username'],
 ],

[
    'class' => EditableColumn::class,
    'attribute' => 'status',
    'url' => ['change-username'],
    'type' => 'select',
    'editableOptions' => function ($model) {
        return [
            'source' => [1 => 'Active', 2 => 'Deleted'],
            'value' => $model->status,
        ];
    },
],

public function actions()
{
    return [
        'change-username' => [
            'class' => EditableAction::class,
            'modelClass' => UserModel::class,
        ],
    ];
}

\yii2mod\editable\Editable::widget([
    'model' => $model,
    'attribute' => 'firstName',
    'url' => '/profile/update',
]);

echo $form->field($model, "firstName")->widget(\yii2mod\editable\Editable::class, [
    'url' => '/profile/update',
    'mode' => 'popup',
]);

php composer.phar