community-features
community-features copied to clipboard
Add the possibility to append additional validation callbacks in Magento\Config\Model\Config\Backend\File
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
Hi @Sartoric. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.
Please, add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.