PHP code example of ianikanov / yii2-wce

1. Go to this page and download the library: Download ianikanov/yii2-wce 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/ */

    

ianikanov / yii2-wce example snippets


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
                ],
            ],
        ],
    ];
}

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

<?= app\widgets\PostControllerWidget::widget([
    'action' => 'index',
    'params' => [
        'query' => $model->getPosts(),
    ],
]) 

<?= app\widgets\PostControllerWidget::widget([
    'action' => 'view',
    'params' => [
        'id' => $post_id,
    ],
]) 

<?= app\widgets\PostControllerWidget::widget(['action' => 'create']) 

<?= app\widgets\PostControllerWidget::widget(['action' => 'update', 'params'=>['id' => $model->id]]) 

<?= app\widgets\PostControllerWidget::widget(['action' => 'delete', 'params'=>['id' => $model->id]])