PHPackages                             ianikanov/yii2-wce - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. ianikanov/yii2-wce

ActiveYii2-extension[Admin Panels](/categories/admin)

ianikanov/yii2-wce
==================

Ability to generate widgets with interface similar to controller with basic CRUD actions for specific model

0.3(6y ago)52.2k↓100%1MITPHP

Since Aug 2Pushed 5y ago2 watchersCompare

[ Source](https://github.com/ianikanov/yii2-wce)[ Packagist](https://packagist.org/packages/ianikanov/yii2-wce)[ RSS](/packages/ianikanov-yii2-wce/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Widget as Controller Yii2 Extension
===================================

[](#widget-as-controller-yii2-extension)

Ability to generate widgets with interface similar to controller with basic CRUD actions for specific model

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist ianikanov/yii2-wce "dev-master"

```

or add

```
"ianikanov/yii2-wce": "dev-master"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, add new template to your config file :

```
if (YII_ENV_DEV) {
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
        'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'],
        'generators' => [ //here
            'widgetCrud' => [
                'class' => '\ianikanov\wce\templates\crud\Generator',
                'templates' => [
                    'WCE' => '@vendor/ianikanov/yii2-wce/templates/crud/default', // template name
                ],
            ],
        ],
    ];
}
```

And register embedded controller:

```
$config = [
    ...
    'controllerMap' => [
        'wce-embed' => '\ianikanov\wce\Controller',
    ],
    ...
];
```

Then run gii, select "CRUD Controller Widget" fill the form and generate the code.

To use widget in any other form follow examples below.

To show list of items, for example, the list of Posts related to the current model:

```

```

To show a single item details, for example the post

```

```

To show create button with modal window:

```
