File tree 2 files changed +44
-0
lines changed
2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -393,6 +393,14 @@ private function renderInputFile(): string
393
393
{
394
394
$ options = $ this ->options ;
395
395
396
+ if (isset ($ options ['class ' ]) && str_contains ($ options ['class ' ], 'form-control ' )) {
397
+ $ options ['class ' ] = str_replace ('form-control ' , '' , $ options ['class ' ]);
398
+ }
399
+
400
+ if (isset ($ options ['placeholder ' ]) && $ options ['placeholder ' ] === true ) {
401
+ unset($ options ['placeholder ' ]);
402
+ }
403
+
396
404
if (array_key_exists ('allowMultiple ' , $ this ->config ) && $ this ->config ['allowMultiple ' ]) {
397
405
$ options ['multiple ' ] = true ;
398
406
}
Original file line number Diff line number Diff line change @@ -203,6 +203,42 @@ public function testName(): void
203
203
);
204
204
}
205
205
206
+ public function testNotClassFormControl (): void
207
+ {
208
+ $ this ->mockApplication ();
209
+
210
+ $ filePond = FilePond::widget (
211
+ [
212
+ 'attribute ' => 'array ' ,
213
+ 'model ' => new TestForm (),
214
+ 'options ' => ['class ' => 'form-control ' ],
215
+ ],
216
+ );
217
+
218
+ $ this ->assertSame (
219
+ '<input class="filepond" id="testform-array" name="TestForm[array][]" type="file"> ' ,
220
+ $ filePond ,
221
+ );
222
+ }
223
+
224
+ public function testNotClassPlaceholder (): void
225
+ {
226
+ $ this ->mockApplication ();
227
+
228
+ $ filePond = FilePond::widget (
229
+ [
230
+ 'attribute ' => 'array ' ,
231
+ 'model ' => new TestForm (),
232
+ 'options ' => ['placeholder ' => true ],
233
+ ],
234
+ );
235
+
236
+ $ this ->assertSame (
237
+ '<input class="filepond" id="testform-array" name="TestForm[array][]" type="file"> ' ,
238
+ $ filePond ,
239
+ );
240
+ }
241
+
206
242
public function testPluingDefault (): void
207
243
{
208
244
$ this ->mockApplication ();
You can’t perform that action at this time.
0 commit comments