kartik-v / yii2-tree-manager

An advanced tree management module using nested sets for Yii 2.
http://demos.krajee.com/tree-manager
Other
150 stars 107 forks source link

How to Extend Module in yii2-tree-manager\src\Module.php?? #201

Closed amol1988 closed 6 years ago

amol1988 commented 6 years ago

I want to create treeview for different tables and modules. I don't want to make changes in Original Module. I just want to extend yii2-tree-manager\src\Module.php file and i want use that new Module in different treeviews. I cant use Original Module becoz 'keyAttribute' => 'id' and for my table i have different Primary Key names.

My Question is, Is it possible to extend Module? or is there any other way to solve this Problem..

kartik-v commented 6 years ago

Creating multiple tree models for different tables is easy and straightforward. Just extend them from the kartik\tree\models\Tree or use the trait kartik\tree\models\TreeTrait and you can have any number of fields in the tables.

If you need multiple modules... its supported in a way if you nest the same treemanager module within multiple different modules in addition to the app level modules configuration (which will be globally recognized). Extension will automatically detect the module context and pick the configuration of treemanager specific to the module.