community-features icon indicating copy to clipboard operation
community-features copied to clipboard

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

Open Sartoric opened this issue 3 years ago • 1 comments

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

Sartoric avatar Aug 25 '21 11:08 Sartoric

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


m2-assistant[bot] avatar Aug 25 '21 11:08 m2-assistant[bot]