Download the PHP package quanzo/yii2-tree without Composer
On this page you can find all versions of the php package quanzo/yii2-tree. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download quanzo/yii2-tree
More information about quanzo/yii2-tree
Files in quanzo/yii2-tree
Download quanzo/yii2-tree
More information about quanzo/yii2-tree
Files in quanzo/yii2-tree
Vendor quanzo
Package yii2-tree
Short Description Ajax tree mapping. Adjacency list tree type. The ability to change the structure.
License MIT
Package yii2-tree
Short Description Ajax tree mapping. Adjacency list tree type. The ability to change the structure.
License MIT
Please rate this library. Is it a good library?
Informations about the package yii2-tree
Ajax output Adjacency List tree - module for Yii2
Install
Install via Composer:
composer require quanzo/yii2-tree
or add
"quanzo/yii2-tree" : "*"
to the require
section of your composer.json
file.
Config
$config = [
...
'modules' => [
...
'tree' => [
'class' => 'x51\yii2\modules\tree\Module',
'tree' => [ // tree configs
'category' => [
'tableName' => '{{%category}}',
'keyField' => 'id',
'parentField' => 'post_parent',
'nameField' => 'post_name',
],
'articles' => [
'module' => 'articles',
//'where' => ['post_type'=>'category'],
'name' => function ($arItem) {
return '[' . $arItem['post_type'] . '] ' . $arItem['post_title'];
},
],
'category' => [
'module' => 'articles',
'where' => ['post_type' => 'category'],
],
],
],
// another definition
'rubricator' => [
'class' => '\x51\yii2\modules\tree\Module',
'itemTemplate' => '<li><span class="expand" data-id="{id}" data-tree="{tree}">⊕</span><a href="{url}" class="item" data-id="{id}" data-tree="{tree}">{name}</a><span class="subitems">{subitems}</span></li>',
'params' => [ // Extra options. see itemTemplate
'url' => function ($cfg, $item) {
if (!empty($cfg['module'])) {
return yii\helpers\Url::to(['/articles/post/view', 'id' => $item['id']]);
} else {
return '##';
}
},
],
'tree' => [
'articles' => [
'module' => 'articles',
'where' => ['post_type' => 'category'],
'urlDelete' => false,
'urlMove' => false,
'allowSelect' => false,
'activeID' => function ($cfg) {
if (!empty($_GET['id'])) {
return intval($_GET['id']);
}
return false;
},
],
],
],
...
],
...
];
Using
echo \Yii::$app->getModule('tree')->widget('category');
// or
echo \Yii::$app->getModule('tree')->widget('category', $arAdvParams);
/* reassign parameters
$arAdvParams = [
...
'urlDelete' => false,
'urlMove' => false,
'urlBranch' => false,
...
];
*/
All versions of yii2-tree with dependencies
PHP Build Version
Package Version
The package quanzo/yii2-tree contains the following files
Loading the files please wait ....