Skip to content

Commit

Permalink
Fix the missing support for file uploads in Form component for Contao 5
Browse files Browse the repository at this point in the history
  • Loading branch information
qzminski committed Nov 20, 2023
1 parent 8a60840 commit 25b2f0e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Codefog\HasteBundle\Form\Validator\ValidatorInterface;
use Codefog\HasteBundle\Model\DcaRelationsModel;
use Codefog\HasteBundle\Util\ArrayPosition;
use Composer\InstalledVersions;
use Contao\ArrayUtil;
use Contao\Controller;
use Contao\DataContainer;
Expand Down Expand Up @@ -924,6 +925,11 @@ public function fetch(string $fieldName): mixed

$widget = $this->widgets[$fieldName];

// Support file uploads in Contao 5
if (version_compare(InstalledVersions::getVersion('contao/core-bundle'), '5.0', '>=') && $widget instanceof UploadableWidgetInterface) {
return $widget->value;
}

if (!$widget->submitInput()) {
// Do not throw exception here for BC
return null;
Expand Down

0 comments on commit 25b2f0e

Please sign in to comment.