1 | <?php |
||
35 | 1 | abstract class ConfirmerAttributes extends BaseControl |
|
36 | { |
||
37 | /** |
||
38 | * @var array localization strings |
||
39 | */ |
||
40 | public static $strings = [ |
||
41 | 'yes' => 'Yes', |
||
42 | 'no' => 'No', |
||
43 | 'expired' => 'Confirmation token has expired. Please try action again.', |
||
44 | ]; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $cssClass; |
||
50 | |||
51 | /** |
||
52 | * @var string|callable heading |
||
53 | */ |
||
54 | protected $heading; |
||
55 | |||
56 | /** |
||
57 | * @var string|callable question |
||
58 | */ |
||
59 | protected $question; |
||
60 | |||
61 | /** |
||
62 | * @var string|callable icon |
||
63 | */ |
||
64 | protected $icon; |
||
65 | |||
66 | /** |
||
67 | * @var callable |
||
68 | */ |
||
69 | protected $handler; |
||
70 | |||
71 | /** |
||
72 | * @var bool |
||
73 | */ |
||
74 | protected $useAjax = TRUE; |
||
75 | |||
76 | /** |
||
77 | * @var Storage\IStorage |
||
78 | */ |
||
79 | protected $storage; |
||
80 | |||
81 | /** |
||
82 | * @param Storage\IStorage $storage |
||
83 | */ |
||
84 | public function injectStorage(Storage\IStorage $storage) |
||
89 | |||
90 | /** |
||
91 | * Set dialog heading |
||
92 | * |
||
93 | * @param string|callable $heading |
||
94 | * |
||
95 | * @return void |
||
96 | * |
||
97 | * @throws Exceptions\InvalidArgumentException |
||
98 | */ |
||
99 | public function setHeading($heading) |
||
107 | |||
108 | /** |
||
109 | * Get dialog heding |
||
110 | * |
||
111 | * @return string|NULL |
||
112 | * |
||
113 | * @throws Exceptions\InvalidStateException |
||
114 | */ |
||
115 | public function getHeading() |
||
119 | |||
120 | /** |
||
121 | * Set dialog question |
||
122 | * |
||
123 | * @param string|callable $question |
||
124 | * |
||
125 | * @return void |
||
126 | * |
||
127 | * @throws Exceptions\InvalidArgumentException |
||
128 | */ |
||
129 | public function setQuestion($question) |
||
137 | |||
138 | /** |
||
139 | * @return string|bool |
||
140 | * |
||
141 | * @throws Exceptions\InvalidStateException |
||
142 | */ |
||
143 | public function getQuestion() |
||
161 | |||
162 | /** |
||
163 | * Set dialog icon |
||
164 | * |
||
165 | * @param string|callable $icon |
||
166 | * |
||
167 | * @return void |
||
168 | * |
||
169 | * @throws Exceptions\InvalidArgumentException |
||
170 | */ |
||
171 | public function setIcon($icon) |
||
179 | |||
180 | /** |
||
181 | * @return string|NULL |
||
182 | * |
||
183 | * @throws Exceptions\InvalidStateException |
||
184 | */ |
||
185 | public function getIcon() |
||
189 | |||
190 | /** |
||
191 | * Set dialog handler |
||
192 | * |
||
193 | * @param callable $handler |
||
194 | * |
||
195 | * @return void |
||
196 | * |
||
197 | * @throws Exceptions\InvalidArgumentException |
||
198 | */ |
||
199 | public function setHandler($handler) |
||
208 | |||
209 | /** |
||
210 | * @return callable |
||
211 | */ |
||
212 | public function getHandler() : callable |
||
216 | |||
217 | /** |
||
218 | * @param Nette\ComponentModel\IContainer $obj |
||
219 | * @param array $params |
||
220 | * |
||
221 | * @return mixed |
||
222 | * |
||
223 | * @throws Exceptions\HandlerNotCallableException |
||
224 | */ |
||
225 | public function callHandler(Nette\ComponentModel\IContainer $obj, array $params) |
||
245 | |||
246 | /** |
||
247 | * @return void |
||
248 | */ |
||
249 | public function enableAjax() |
||
253 | |||
254 | /** |
||
255 | * @return void |
||
256 | */ |
||
257 | public function disableAjax() |
||
261 | |||
262 | /** |
||
263 | * @return Application\UI\Form |
||
264 | */ |
||
265 | protected function createComponentForm() |
||
285 | |||
286 | /** |
||
287 | * @param callable|string $var |
||
288 | * |
||
289 | * @return bool |
||
290 | * |
||
291 | * @throws Exceptions\InvalidArgumentException |
||
292 | */ |
||
293 | protected function checkCallableOrString($var) : bool |
||
301 | |||
302 | /** |
||
303 | * @param callable $attribute |
||
304 | * |
||
305 | * @return string |
||
306 | * |
||
307 | * @throws Exceptions\InvalidStateException |
||
308 | */ |
||
309 | protected function callCallableAttribute($attribute) : string |
||
323 | |||
324 | /** |
||
325 | * @param string $token |
||
326 | * |
||
327 | * @return array |
||
328 | * |
||
329 | * @throws Exceptions\InvalidStateException |
||
330 | */ |
||
331 | protected function getConfirmerValues(string $token) : array |
||
343 | |||
344 | /** |
||
345 | * @param string $attribute |
||
346 | * |
||
347 | * @return string|NULL |
||
348 | * @throws Exceptions\InvalidStateException |
||
349 | */ |
||
350 | private function getAttribute(string $attribute) |
||
362 | } |
||
363 |