PHP code example of sergmoro1 / yii2-modal-crud

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

    

sergmoro1 / yii2-modal-crud example snippets


namespace backend\controllers;

use sergmoro1\modal\controllers\ModalController;

use common\models\Property;
use common\models\PropertySearch;

class PropertyController extends ModalController
{
    public function newModel() { return new Property(); }
    public function newSearch() { return new PropertySearch(); }
}


use Yii;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\bootstrap\Modal;

// bind actions
$this->registerJs('var popUp = {"id": "property", "actions": ["update"]};', yii\web\View::POS_HEAD);
sergmoro1\modal\assets\PopUpAsset::register($this);

$this->title = Yii::t('app', 'Properties');

echo Modal::widget([
    'id' => 'property-win',
    'toggleButton' => false,
    'header' => $this->title,
    'footer' => 
        '<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>'. 
        '<button type="button" class="btn btn-primary">Save</button>',
]);