Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file type attr #328

Merged
merged 7 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Dynamic/Types/AttachmentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public function build(FormBuilderInterface $builder, FormField $field, string $l
}
}

$options['attr']['accept'] = \implode(',', $mimeTypes);
if (!empty($mimeTypes)) {
$options['attr']['accept'] = \implode(',', $mimeTypes);
}
Comment on lines +57 to +59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


// File Constraint.
if ($translation->getOption('type') === ['image']) {
Expand All @@ -79,7 +81,9 @@ public function build(FormBuilderInterface $builder, FormField $field, string $l
'max' => $fileMax,
]);

// @deprecated remove when a new major is release as max is not supported by input[type=file]
$options['attr']['max'] = $fileMax;
$options['attr']['data-max'] = $fileMax;
}

$options['multiple'] = true;
Expand Down
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Upgrade

## 2.5.3

### Deprecate attribute max on AttachmentType

The attribute max is deprecated on AttachmentType since it is not applicable to input type file.
A new attribute data-max was added to let you use this data in your custom templates.

## 2.5.0

### Deprecate Swiftmailer
Expand Down
Loading