|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | /** |
4 | | - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2019 |
| 4 | + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2022 |
5 | 5 | * @package yii2-tree |
6 | 6 | * @version 1.1.3 |
7 | 7 | */ |
8 | 8 |
|
9 | 9 | namespace kartik\tree; |
10 | 10 |
|
| 11 | +use Yii; |
11 | 12 | use yii\helpers\Url; |
12 | 13 | use yii\helpers\ArrayHelper; |
| 14 | +use yii\web\Application as WebApplication; |
13 | 15 |
|
14 | 16 | /** |
15 | | - * The tree management module for Yii Framework 2.0. |
| 17 | + * Module is the tree management module for Yii Framework 2.0 that enables the [[TreeView]] widget functionality. |
16 | 18 | * |
| 19 | + * To use, configure the module named `treemanager` in the modules section of your Yii configuration file. |
| 20 | + * |
| 21 | + * For example, |
| 22 | + * |
| 23 | + * ```php |
| 24 | + * 'modules' => [ |
| 25 | + * 'treemanager' => [ |
| 26 | + * 'class' => '\kartik\tree\Module', |
| 27 | + * // other module settings, refer detailed documentation |
| 28 | + * ] |
| 29 | + * ] |
| 30 | + * ``` |
17 | 31 | * @author Kartik Visweswaran <[email protected]> |
18 | 32 | * @since 1.0 |
19 | 33 | */ |
20 | 34 | class Module extends \kartik\base\Module |
21 | 35 | { |
22 | 36 | /** |
23 | | - * The module name for Krajee treeview |
| 37 | + * @var string module name for the Krajee Tree management module |
24 | 38 | */ |
25 | 39 | const MODULE = 'treemanager'; |
26 | 40 | /** |
27 | | - * Manage node action |
| 41 | + * @var string manage node action |
28 | 42 | */ |
29 | 43 | const NODE_MANAGE = 'manage'; |
30 | 44 | /** |
31 | | - * Remove node action |
| 45 | + * @var string remove node action |
32 | 46 | */ |
33 | 47 | const NODE_REMOVE = 'remove'; |
34 | 48 | /** |
35 | | - * Move node action |
| 49 | + * @var string move node action |
36 | 50 | */ |
37 | 51 | const NODE_MOVE = 'move'; |
38 | 52 | /** |
39 | | - * Save node action |
| 53 | + * @var string save node action |
40 | 54 | */ |
41 | 55 | const NODE_SAVE = 'save'; |
42 | 56 | /** |
43 | | - * Tree details form view - Section Part 1 |
| 57 | + * @var int section part 1 of the tree details form view |
44 | 58 | */ |
45 | 59 | const VIEW_PART_1 = 1; |
46 | 60 | /** |
47 | | - * Tree details form view - Section Part 2 |
| 61 | + * @var int section part 2 of the tree details form view |
48 | 62 | */ |
49 | 63 | const VIEW_PART_2 = 2; |
50 | 64 | /** |
51 | | - * Tree details form view - Section Part 3 |
| 65 | + * @var int section part 3 of the tree details form view |
52 | 66 | */ |
53 | 67 | const VIEW_PART_3 = 3; |
54 | 68 | /** |
55 | | - * Tree details form view - Section Part 4 |
| 69 | + * @var int section part 4 of the tree details form view |
56 | 70 | */ |
57 | 71 | const VIEW_PART_4 = 4; |
58 | 72 | /** |
59 | | - * Tree details form view - Section Part 5 |
| 73 | + * @var int section part 5 of the tree details form view |
60 | 74 | */ |
61 | 75 | const VIEW_PART_5 = 5; |
62 | 76 |
|
63 | 77 | /** |
64 | | - * @var array the configuration of nested set attributes structure |
| 78 | + * @var array the configuration of nested set attributes structure. |
65 | 79 | */ |
66 | 80 | public $treeStructure = []; |
67 | 81 |
|
@@ -124,8 +138,7 @@ public function init() |
124 | 138 | 'iconTypeAttribute' => 'icon_type' |
125 | 139 | ]; |
126 | 140 | $nodeActions = ArrayHelper::getValue($this->treeViewSettings, 'nodeActions', []); |
127 | | - // prepends Error in Console Applications |
128 | | - if (\Yii::$app instanceof \yii\web\Application) { |
| 141 | + if (Yii::$app instanceof WebApplication) { |
129 | 142 | $nodeActions += [ |
130 | 143 | self::NODE_MANAGE => Url::to(['/treemanager/node/manage']), |
131 | 144 | self::NODE_SAVE => Url::to(['/treemanager/node/save']), |
|
0 commit comments