1 | <?php |
||
18 | class ItemDetail |
||
19 | { |
||
20 | |||
21 | use Traits\ButtonIconTrait; |
||
22 | |||
23 | /** |
||
24 | * (renderer | template | block) |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $type; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $template; |
||
33 | |||
34 | /** |
||
35 | * @var callable |
||
36 | */ |
||
37 | protected $renderer; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $title = 'show'; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $class = 'btn btn-xs btn-default ajax'; |
||
48 | |||
49 | /** |
||
50 | * @var string |
||
51 | */ |
||
52 | protected $icon = 'eye'; |
||
53 | |||
54 | /** |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $text = ''; |
||
58 | |||
59 | /** |
||
60 | * @var DataGrid |
||
61 | */ |
||
62 | protected $grid; |
||
63 | |||
64 | /** |
||
65 | * @var string|bool |
||
66 | */ |
||
67 | protected $primary_where_column; |
||
68 | |||
69 | /** |
||
70 | * @var ItemDetailForm |
||
71 | */ |
||
72 | protected $form; |
||
73 | |||
74 | /** |
||
75 | * @var array |
||
76 | */ |
||
77 | protected $template_parameters = []; |
||
78 | |||
79 | |||
80 | /** |
||
81 | * @param DataGrid $grid |
||
82 | * @param string $primary_where_column |
||
83 | */ |
||
84 | public function __construct(DataGrid $grid, $primary_where_column) |
||
89 | |||
90 | |||
91 | /** |
||
92 | * Render row item detail button |
||
93 | * @param Row $row |
||
94 | * @return Html |
||
95 | */ |
||
96 | public function renderButton($row) |
||
112 | |||
113 | |||
114 | /** |
||
115 | * Render item detail |
||
116 | * @param mixed $item |
||
117 | * @return mixed |
||
118 | */ |
||
119 | public function render($item) |
||
129 | |||
130 | |||
131 | /** |
||
132 | * Get primary column for where clause |
||
133 | * @return string|bool |
||
134 | */ |
||
135 | public function getPrimaryWhereColumn() |
||
139 | |||
140 | |||
141 | /** |
||
142 | * Set attribute title |
||
143 | * @param string $title |
||
144 | */ |
||
145 | public function setTitle($title) |
||
151 | |||
152 | |||
153 | /** |
||
154 | * Get attribute title |
||
155 | * @return string |
||
156 | */ |
||
157 | public function getTitle() |
||
161 | |||
162 | |||
163 | /** |
||
164 | * Set attribute class |
||
165 | * @param string $class |
||
166 | */ |
||
167 | public function setClass($class) |
||
173 | |||
174 | |||
175 | /** |
||
176 | * Get attribute class |
||
177 | * @return string |
||
178 | */ |
||
179 | public function getClass() |
||
183 | |||
184 | |||
185 | /** |
||
186 | * Set icon |
||
187 | * @param string $icon |
||
188 | */ |
||
189 | public function setIcon($icon) |
||
195 | |||
196 | |||
197 | /** |
||
198 | * Get icon |
||
199 | * @return string |
||
200 | */ |
||
201 | public function getIcon() |
||
205 | |||
206 | |||
207 | /** |
||
208 | * Set text |
||
209 | * @param string $text |
||
210 | */ |
||
211 | public function setText($text) |
||
217 | |||
218 | |||
219 | /** |
||
220 | * Get text |
||
221 | * @return string |
||
222 | */ |
||
223 | public function getText() |
||
227 | |||
228 | |||
229 | /** |
||
230 | * Set item detail type |
||
231 | * @param string $type |
||
232 | */ |
||
233 | public function setType($type) |
||
239 | |||
240 | |||
241 | /** |
||
242 | * Get item detail type |
||
243 | * @return string |
||
244 | */ |
||
245 | public function getType() |
||
249 | |||
250 | |||
251 | /** |
||
252 | * Set item detail template |
||
253 | * @param string $template |
||
254 | */ |
||
255 | public function setTemplate($template) |
||
261 | |||
262 | |||
263 | /** |
||
264 | * Get item detail template |
||
265 | * @return string |
||
266 | */ |
||
267 | public function getTemplate() |
||
271 | |||
272 | |||
273 | /** |
||
274 | * Set item detail renderer |
||
275 | * @param callable $renderer |
||
276 | */ |
||
277 | public function setRenderer($renderer) |
||
283 | |||
284 | |||
285 | /** |
||
286 | * Get item detail renderer |
||
287 | * @return callable |
||
288 | */ |
||
289 | public function getRenderer() |
||
293 | |||
294 | |||
295 | /** |
||
296 | * @param ItemDetailForm $form |
||
297 | * @return static |
||
298 | */ |
||
299 | public function setForm(ItemDetailForm $form) |
||
305 | |||
306 | |||
307 | /** |
||
308 | * @return ItemDetailForm |
||
309 | */ |
||
310 | public function getForm() |
||
314 | |||
315 | |||
316 | /** |
||
317 | * @param array $template_parameters |
||
318 | * @return static |
||
319 | */ |
||
320 | public function setTemplateParameters(array $template_parameters) |
||
326 | |||
327 | |||
328 | public function getTemplateVariables() |
||
332 | |||
333 | } |
||
334 |