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 5 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,
]);

// TODO : Remove when a new major is release and tell user to migrate to data-max attribute
alexander-schranz marked this conversation as resolved.
Show resolved Hide resolved
$options['attr']['max'] = $fileMax;
$options['attr']['data-max'] = $fileMax;
}

$options['multiple'] = true;
Expand Down
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
To support Symfony 6 and Sulu 2.5 the usage of Swiftmailer has been deprecated.
Remove the `Swiftmailer` from your project to automatically use the `symfony/mailer` instead.

### 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.4.0

### CSRF Protection disabled
Expand Down