1 | <?php |
||
24 | class FileUpload extends InputWidget |
||
25 | { |
||
26 | /** |
||
27 | * Widget id. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | public $id = 'fileupload'; |
||
32 | |||
33 | /** |
||
34 | * Theme class |
||
35 | * |
||
36 | * @var string|array |
||
37 | */ |
||
38 | public $theme = BaseTheme::class; |
||
39 | |||
40 | /** |
||
41 | * Html options. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | public $options = []; |
||
46 | |||
47 | /** |
||
48 | * Upload url |
||
49 | * |
||
50 | * @var string |
||
51 | */ |
||
52 | public $uploadUrl = 'site/file-upload'; |
||
53 | |||
54 | /** |
||
55 | * Remove url |
||
56 | * |
||
57 | * @var string |
||
58 | */ |
||
59 | public $deleteUrl = 'site/file-delete'; |
||
60 | |||
61 | /** |
||
62 | * Class name |
||
63 | * |
||
64 | * @var UploaderInterface string |
||
65 | */ |
||
66 | public $uploader; |
||
67 | |||
68 | /** |
||
69 | * User data, send in receptorClass method. |
||
70 | * |
||
71 | * @var array |
||
72 | */ |
||
73 | public $userData = []; |
||
74 | |||
75 | /** |
||
76 | * Run widget |
||
77 | */ |
||
78 | public function run() |
||
91 | |||
92 | /** |
||
93 | * Get theme |
||
94 | * |
||
95 | * @return ThemeInterface |
||
96 | * |
||
97 | * @throws Exception |
||
98 | */ |
||
99 | protected function buildTheme(): ThemeInterface |
||
127 | |||
128 | /** |
||
129 | * Generate html options for widget. |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | public function generateHtmlOptions(): array |
||
139 | |||
140 | /** |
||
141 | * Generate upload url. |
||
142 | * |
||
143 | * @param string $url |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | public function generateUrl(?string $url): ?string |
||
164 | |||
165 | /** |
||
166 | * Decode server options. |
||
167 | * |
||
168 | * @param string $data Data key for decode server options |
||
169 | * |
||
170 | * @return array $data Return array of data |
||
171 | * |
||
172 | * @throws Exception |
||
173 | */ |
||
174 | public static function decodeServerOptions($data): array |
||
195 | |||
196 | /** |
||
197 | * Encode server options. |
||
198 | * |
||
199 | * @return string $data Return encode array of data |
||
200 | * |
||
201 | * @param array $data Server options for uploader |
||
202 | * |
||
203 | * @throws Exception |
||
204 | */ |
||
205 | public static function encodeServerOptions($data): string |
||
213 | |||
214 | /** |
||
215 | * Register client scripts |
||
216 | */ |
||
217 | protected function registerClientScripts() |
||
222 | } |
||
223 |