Skip to content

Commit 3b17248

Browse files
Fix Boostrap5. (#4)
1 parent 226e857 commit 3b17248

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/FilePond.php

+8
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,14 @@ private function renderInputFile(): string
393393
{
394394
$options = $this->options;
395395

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+
396404
if (array_key_exists('allowMultiple', $this->config) && $this->config['allowMultiple']) {
397405
$options['multiple'] = true;
398406
}

tests/RenderTest.php

+36
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,42 @@ public function testName(): void
203203
);
204204
}
205205

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+
206242
public function testPluingDefault(): void
207243
{
208244
$this->mockApplication();

0 commit comments

Comments
 (0)