PHP code example of zlatov / yii-components

1. Go to this page and download the library: Download zlatov/yii-components 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/ */

    

zlatov / yii-components example snippets


use \Zlatov\yiiComponents\behaviors\Sid;

...

    public function behaviors()
    {
        return [

            ...

            'sid' => [
                'class' => Sid::className(),
                'in_attribute' => 'header',
            ],

            ...

        ];
    }
    
    ...

    public function rules()
    {
        return Sid::calcRules(parent::rules());
    }

<?= ViewTree::widget([
	'ztree' => $current_menu,
	'current_id' => $model->id,
]) 

    public function actionIndex()
    {
        $sections = Section::treeMulti();

        return $this->render('index', [
            'sections' => $sections,
        ]);
    }

    <?= Zlatov\yiiComponents\widgets\ViewTree::widget([
        'viewTree' => $sections,
        'options' => [
            'admin' => true,
        ],
        'model' => null
    ]) 

Zlatov\yiiComponents\assets\FormAsset::register($this);