-
Notifications
You must be signed in to change notification settings - Fork 518
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
Refactor: Make VichImageType class extensible by removing 'final' #1406
Conversation
This commit updates the VichImageType class by removing the 'final' keyword, thereby allowing for extension of the class. This modification maintains consistency with Symfony's practice of non-final form types, enabling developers to extend this form type to add custom functionality or modifications as needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add the "accept" option as well?
@garak I'm not sure about what you are referring to. Can you precise? :) |
The "attr" option in this comment #625 (comment) |
The commit refines VichImageType by incorporating a default 'accept' attribute, specifying common image MIME types. This provides a sensible default, simplifying the setup for typical use cases while retaining the ability for users to override it as needed.
@garak Done 👍 |
src/Form/Type/VichImageType.php
Outdated
@@ -43,6 +43,9 @@ public function configureOptions(OptionsResolver $resolver): void | |||
'image_uri' => true, | |||
'imagine_pattern' => null, | |||
'storage_resolve_method' => self::STORAGE_RESOLVE_URI, | |||
'attr' => [ | |||
'accept' => 'image/png,image/jpeg,image/gif,image/webp', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'image/*'
is probably better (more synthetic and open to possible other formats)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'image/*'
is probably better (more synthetic and open to possible other formats)
Agreed, and done
…VichImageType Adjust the default 'accept' attribute in VichImageType to 'image/*' to encompass all image formats, providing a more inclusive and future-proof default setting.
This commit updates the VichImageType class by removing the 'final' keyword, thereby allowing for extension of the class. This modification maintains consistency with Symfony's practice of non-final form types, enabling developers to extend this form type to add custom functionality or modifications as needed.