PHP code example of prokhonenkov / yii2-repeater

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

    

prokhonenkov / yii2-repeater example snippets




return [
    // ... your config
    'modules' => [
        'repeater'=> [
            'class' => \prokhonenkov\repeater\Repeater::class
        ],
    ],
    'bootstrap' => [        
        'repeater' // add module id to bootstrap for proper aliases and url routes binding
    ]


<?= \prokhonenkov\repeater\widgets\RepeaterWidget::widget([
    'className' => \app\models\TestRepeater::class,
    'modelView' => '@app/views/site/repeater',
    'models' => [ //list of your models
        new \app\models\TestRepeater(),

    ],
    'btnNewTitle' => 'Add main container',
    'addCallback' => new \yii\web\JsExpression("
        function(data){
           console.log(data);
        }
    "),
    'removeCallback' => new \yii\web\JsExpression("
        function(data){
           console.log(data);
        }
    ")
]);

 
    class TestRepeater extends Model
    {
        public $title;
        public $text;
    
        public function rules()
        {
            return [
                [['date', 'text'], 'safe']
            ];
        }
    }



/** @var \app\models\TestRepeater $model */
/** @var int $id */


php composer.phar