Skip to content

WIP: Fix bug on multistep - #11

Draft
rintisch wants to merge 1 commit into
WapplerSystems:release/v11from
rintisch:issue/8-bug-expection-error-multiple-files
Draft

WIP: Fix bug on multistep#11
rintisch wants to merge 1 commit into
WapplerSystems:release/v11from
rintisch:issue/8-bug-expection-error-multiple-files

Conversation

@rintisch

@rintisch rintisch commented Feb 23, 2023

Copy link
Copy Markdown

This tries to solve #8

What I did so far:

  • Add a customized UploadResourceViewHelper.
    • Is an adapted version of the original from EXT:form
    • Adapted is the method getUploadedResource()
    • New is addFileInFormFrontend()

This solves the named bug.

BUT

EmailFinisher fails

To make it working also an adaption in https://github.com/TYPO3/typo3/blob/10cbd42b3f67717e842233ddf8a6cb7a9af6af78/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php#L152-L155 is needed. It would need to become something like the following:

if ($file instanceof FileReference) {
    $file = $file->getOriginalResource();
}
if (is_array($file)) {
    foreach ($file as $item) {

        if ($item instanceof FileReference) {
            $item = $item->getOriginalResource();
        }

        $mail->attach($item->getContents(), $item->getName(), $item->getMimeType());
    }
} else {
    $mail->attach($file->getContents(), $file->getName(), $file->getMimeType());
}

Therefore it might be the best to add a new finisher like MultiUploadEmailFinisher which contains this adaption. Has the downside that the editor needs to know that this finisher must be used...

Failing when form is rerendered

Furthermore does it fail if you go back and forth in a multistep form or if a user violates a validator. I do not know how this work at all. Has someone a hint how EXT:form makes this working when using a single file? Does my solution from above break something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant