AttachableUploadElementInterface
The Email of this extension attaches uploaded files to the mail
when the finisher option attach is enabled. By default only the
core File element is considered.
A custom form element that stores uploaded files can opt in by implementing
LIA\.
No finisher override and no service re-binding is needed.
Contract
The element value returned by the Form must be null, a
TYPO3\, a
TYPO3\, or an array or
TYPO3\ of those. null entries
are skipped. Any other value makes the finisher throw a Finisher,
so a broken upload element fails loudly instead of sending a mail without its
attachments.
Example
<?php
declare(strict_types=1);
namespace MY\MyExtension\Domain\Model\FormElements;
use LIA\LiaForm\Domain\Model\FormElements\AttachableUploadElementInterface;
use TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement;
final class MyUploadElement extends AbstractFormElement implements AttachableUploadElementInterface
{
// Wire the UploadedFileReferenceConverter in initializeFormElement()
// as the core FileUpload element does; the finisher does the rest.
}
Whether a mail gets attachments at all is still decided per finisher through
attach in the form definition.