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

Refactor: Make VichImageType class extensible by removing 'final' #1406

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

Erdou
Copy link
Contributor

@Erdou Erdou commented Nov 5, 2023

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.

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.
Copy link
Collaborator

@garak garak left a 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?

@Erdou
Copy link
Contributor Author

Erdou commented Nov 6, 2023

@garak I'm not sure about what you are referring to. Can you precise? :)

@garak
Copy link
Collaborator

garak commented Nov 7, 2023

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.
@Erdou
Copy link
Contributor Author

Erdou commented Nov 9, 2023

@garak Done 👍

@@ -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',
Copy link
Collaborator

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)

Copy link
Contributor Author

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.
@garak garak merged commit 18c6976 into dustin10:master Nov 9, 2023
9 checks passed
@Erdou Erdou deleted the update-form-type branch November 9, 2023 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants