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 108 forks source link

How can I add a custom property to kartik\tree\TreeView ? #159

Closed niksan8989 closed 6 years ago

niksan8989 commented 7 years ago

Sorry for the silly question. Is there a way to add my own property into class kartik\tree\TreeView? I wish It looked like this:

echo TreeView::widget([
    'query' => Product::find()->addOrderBy('root, lft'), 
    'headingOptions' => ['label' => 'Categories'],
   ...
   //My own property
    'myOwnProperty' => 'Test'
]);

Or the only way to do this is using inheritance?

kartik-v commented 7 years ago

Yes only through inheritance by extending the class.

But you may want to let know if there is any enhancement to be done specific to any functionality which can be incorporated in the TreeView class.