magento / magento/community-features
Add the possibility to append additional validation callbacks in Magento\Config\Model\Config\Backend\File
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 46
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
### Description (*)
Consider the case of a custom file upload.
We can extend the File class and add, let's say, a specific file extension via _getAllowedExtensions
Why we shouldn't be able to add one or more callbacks for validations too ?
At the moment the only way to do it, it's to completely override the beforeSave() function as we have no method (or property) we can use to set an array of additional callbacks.
The method addValidateCallback is called to add only "file size validation"
### Expected behavior (*)
A way to specify additional validation callbacks
### Benefits
Cleaner code
Less overridden magento code
### Additional information
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting Magento\Config\Model\Config\Backend\File, especially beforeSave() and addValidateCallback(). Determine how validation callbacks are currently stored and invoked, then define the registration behavior needed for additional callbacks. Done means custom file-upload validation can be added without completely overriding beforeSave().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100