Skip to content

Commit

Permalink
Refactor input widget instantiation in FilePond.php.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Jan 2, 2024
1 parent faa930f commit 036f0eb
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/FilePond.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
use JsonException;
use PHPForge\Html\Helper\CssClass;
use PHPForge\Html\Helper\Utils;
use PHPForge\Html\Input;
use PHPForge\Html\Tag;
use Yii2\Extensions\FilePond\Asset\FilePondAsset;
use Yii2\Extensions\FilePond\Asset\FilePondCdnAsset;
use Yii;
use yii\helpers\Html;
use yii\widgets\InputWidget;

final class FilePond extends InputWidget
Expand Down Expand Up @@ -322,19 +323,6 @@ private function renderInputFile(): string
// input type="file" not supported value attribute.
unset($options['id'], $options['placeholder'], $options['value']);

return match ($this->hasModel()) {
true => Input::widget()
->attributes($options)
->id($this->id)
->name($name)
->type('file')
->render(),
default => Input::widget()
->attributes($options)
->id($this->id)
->name($name)
->type('file')
->render(),
};
return Tag::widget()->attributes($options)->id($this->id)->name($name)->tagName('input')->type('file')->render();
}
}

0 comments on commit 036f0eb

Please sign in to comment.