IMPR: Allow dot syntax UF Setup calls

Example:
new BulkUploader()->setUfSetup('getValidator.setAllowedExtensions', ['jpg', 'jpeg', 'png', 'gif']);
This commit is contained in:
Tony Air 2022-04-19 15:04:45 +02:00 committed by GitHub
parent c34bba4508
commit 357a4fd682
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -250,7 +250,15 @@ class BulkUploader implements GridField_HTMLProvider, GridField_URLHandler
//UploadField setup
foreach ($this->ufSetup as $fn => $param) {
$uploadField->{$fn}($param);
$funcs = explode('.', $fn);
$lastCall = array_pop($funcs);
$res = $uploadField;
foreach ($funcs as $call) {
$res = $res->{$call}();
}
$res->{$lastCall}($param);
}
$schema['data']['createFileEndpoint'] = [