Skip to content

Commit

Permalink
Don't populate UploadedFile on text/select elements & vice versa
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Sep 1, 2023
1 parent 2e09144 commit 69f9397
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/Reporting/Web/Forms/TemplateForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ protected function addColumnSettings($name, $label)
]
]);

$valueType = $this->getValue($type, 'none');
$populated = $this->getPopulatedValue($value);
if (
($valueType === 'image' && ! $populated instanceof UploadedFile)
|| ($valueType !== 'image' && $populated instanceof UploadedFile)
) {
$this->clearPopulatedValue($value);
}

switch ($this->getValue($type, 'none')) {
case 'image':
$this->addElement('file', $value, [
Expand Down

0 comments on commit 69f9397

Please sign in to comment.