1 | <?php |
||
8 | class BatchActions extends AbstractTool |
||
9 | { |
||
10 | /** |
||
11 | * @var Collection |
||
12 | */ |
||
13 | protected $actions; |
||
14 | |||
15 | /** |
||
16 | * @var bool |
||
17 | */ |
||
18 | protected $enableDelete = true; |
||
19 | |||
20 | /** |
||
21 | * @var bool |
||
22 | */ |
||
23 | private $isHoldSelectAllCheckbox = false; |
||
24 | |||
25 | /** |
||
26 | * BatchActions constructor. |
||
27 | */ |
||
28 | public function __construct() |
||
34 | |||
35 | /** |
||
36 | * Append default action(batch delete action). |
||
37 | * |
||
38 | * return void |
||
39 | */ |
||
40 | protected function appendDefaultAction() |
||
44 | |||
45 | /** |
||
46 | * Disable delete. |
||
47 | * |
||
48 | * @return $this |
||
49 | */ |
||
50 | public function disableDelete() |
||
56 | |||
57 | /** |
||
58 | * Disable delete And Hode SelectAll Checkbox |
||
59 | * |
||
60 | * @return $this |
||
61 | */ |
||
62 | public function disableDeleteAndHodeSelectAll() |
||
70 | |||
71 | /** |
||
72 | * Add a batch action. |
||
73 | * |
||
74 | * @param $title |
||
75 | * @param BatchAction|null $action |
||
76 | * |
||
77 | * @return $this |
||
78 | */ |
||
79 | public function add($title, BatchAction $action = null) |
||
95 | |||
96 | /** |
||
97 | * Setup scripts of batch actions. |
||
98 | * |
||
99 | * @return void |
||
100 | */ |
||
101 | protected function setUpScripts() |
||
111 | |||
112 | /** |
||
113 | * Scripts of BatchActions button groups. |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | protected function script() |
||
133 | |||
134 | /** |
||
135 | * Render BatchActions button groups. |
||
136 | * |
||
137 | * @return string |
||
138 | */ |
||
139 | public function render() |
||
159 | } |
||
160 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: