PHP code example of besnovatyj / yii2-cms-tree-manager

1. Go to this page and download the library: Download besnovatyj/yii2-cms-tree-manager 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/ */

    

besnovatyj / yii2-cms-tree-manager example snippets


// Module.php
$this->controllerMap['category'] = [
    'class' => TreeController::class,
    'treeManager' => Instance::of('gallery.tree.manager'),
    'dataSource' => new TreeDataSource(Category::class, ...),
    'createFormClass' => CategoryForm::class,
    'updateFormClass' => CategoryForm::class,
    'formView' => '@Besnovatyj/Gallery/views/backend/category/_form',
    // серверный enforcement прав (опционально; `permissions` виджета — только UX):
    'checkAccess' => fn(string $op, ?Node $node) => Yii::$app->user->can("gallery.tree.{$op}"),
];