2017 © Pedro Peláez
 

yii2-extension yii2-tree

Database tree structures management for Yii 2 framework

image

arogachev/yii2-tree

Database tree structures management for Yii 2 framework

  • Saturday, June 13, 2015
  • by arogachev
  • Repository
  • 2 Watchers
  • 22 Stars
  • 1,637 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 11 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

Yii 2 Tree

Database tree structures management for Yii 2 framework, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Currently it's Nested Sets management extension based on:, (*3)

Contents:, (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

php composer.phar require --prefer-dist arogachev/yii2-tree

or add, (*7)

"arogachev/yii2-tree": "*"

to the require section of your composer.json file., (*8)

Features

  • Basic actions with tree nodes: creating, renaming, moving, deleting
  • Saving state of nodes (opened / closed)
  • Links for updating node

Usage

Add this to application config:, (*9)

'controllerMap' => [
    'tree' => 'arogachev\tree\controllers\TreeController',
],

Attach additional behavior along with NestedSetsBehavior to your model:, (*10)

use arogachev\tree\behaviors\NestedSetsManagementBehavior;
/**
 * @inheritdoc
 */
public function behaviors()
{
    return [
        NestedSetsBehavior::className(),
        NestedSetsManagementBehavior::className(),
    ];
}

The last step is display widget:, (*11)

use arogachev\tree\widgets\NestedSets;
use frontend\modules\department\models\Department;
<?= NestedSets::widget([
    'modelClass' => Department::className(),
]) ?>

Behavior configuration

nameAttribute - string, the name of attribute storing the name of node. Defaults to name., (*12)

saveState - boolean, save state of nodes (opened / closed). Defaults to false., (*13)

isOpenedAttribute - string, the name of attribute storing if the node opened or closed. Used together with saveState. Defaults to is_opened., (*14)

Widget configuration

modelClass - string, the full model class including namespace of managed model. Required., (*15)

updateUrl - string, url for updating model in separate page. Will be processed by yii\helpers\Url::to()., (*16)

jsTreeOptions - array, options for JsTree widget. Example:, (*17)

'jsTreeOptions' => [
    'clientOptions' => [
        'core' => [
            'strings' => [
                'New node' => 'Новый отдел',
            ],
        ],
    ],
],

The Versions

13/06 2015

dev-master

9999999-dev https://github.com/arogachev/yii2-tree

Database tree structures management for Yii 2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexey Rogachev

yii2 nested set widget tree active record nested sets

13/06 2015

0.1.0

0.1.0.0 https://github.com/arogachev/yii2-tree

Database tree structures management for Yii 2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexey Rogachev

yii2 nested set widget tree active record nested sets