'avatar', // required — input name attribute * 'accept' => 'image/*', // required — accepted file types * 'hint' => t('Allowed file types: SVG, PNG, JPG, WEBP'),// optional — hint text below dropzone label * 'currentSrc' => 'admin/tenants/avatar-file?uuid=…&size=128', // optional — URL of existing server file * 'currentLabel' => t('Current image'), // optional — label for current file preview * 'deleteAction' => 'admin/tenants/avatar-delete/…', // optional — formaction for delete button (requires currentSrc) * 'deleteConfirm' => t('Delete this image?'), // optional — confirm message on delete * 'required' => false, // optional — make input required * ]; * require templatePath('partials/app-file-upload.phtml'); * * @var array $fileUpload */ $fileUpload = is_array($fileUpload ?? null) ? $fileUpload : []; $uploadName = trim((string) ($fileUpload['name'] ?? '')); if ($uploadName === '') { return; } $uploadAccept = trim((string) ($fileUpload['accept'] ?? '')); $uploadHint = trim((string) ($fileUpload['hint'] ?? '')); $uploadCurrentSrc = trim((string) ($fileUpload['currentSrc'] ?? '')); $uploadCurrentLabel = trim((string) ($fileUpload['currentLabel'] ?? t('Current image'))); $uploadDeleteAction = trim((string) ($fileUpload['deleteAction'] ?? '')); $uploadDeleteConfirm = trim((string) ($fileUpload['deleteConfirm'] ?? t('Delete this image?'))); $uploadRequired = (bool) ($fileUpload['required'] ?? false); $hasCurrent = $uploadCurrentSrc !== ''; $hasDelete = $hasCurrent && $uploadDeleteAction !== ''; ?>
data-current-src="" data-current-label="">