magento / community-features

Magento Features Development is an Initiative to Allows Community Memebers Join to Development of Magento Features
46 stars 18 forks source link

Add the possibility to append additional validation callbacks in Magento\Config\Model\Config\Backend\File #336

Open Sartoric opened 3 years ago

Sartoric commented 3 years ago

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

m2-assistant[bot] commented 3 years ago

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