From 1c0432c74be9a6876f2a7d7f021f3b6d80bcd4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thierry=20Fran=C3=A7ois?= Date: Sun, 14 Sep 2014 19:01:28 +0300 Subject: [PATCH] Add deprecation for old bulkUpload config api --- bulkUpload/code/GridFieldBulkUpload.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bulkUpload/code/GridFieldBulkUpload.php b/bulkUpload/code/GridFieldBulkUpload.php index 24c9f19..729b6c5 100644 --- a/bulkUpload/code/GridFieldBulkUpload.php +++ b/bulkUpload/code/GridFieldBulkUpload.php @@ -90,7 +90,23 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle */ function setConfig ( $reference, $value ) { - if (!key_exists($reference, $this->config) ) { + if ( in_array($reference, array('folderName', 'maxFileSize', 'sequentialUploads', 'canAttachExisting', 'canPreviewFolder')) ) + { + Deprecation::notice('2.1.0', "GridFieldBulkUpload 'setConfig()' doesn't support '$reference' anymore. Please use 'setUfConfig()', 'setUfSetup()' or 'setUfValidatorSetup()' instead."); + + if ( $reference === 'folderName' ) + { + $this->setUfSetup('setFolderName', $value); + } + else if ( $reference === 'maxFileSize' ) + { + $this->setUfValidatorSetup('setAllowedMaxFileSize', $value); + } + else{ + $this->setUfConfig($reference, $value); + } + } + else if (!key_exists($reference, $this->config) ) { user_error("Unknown option reference: $reference", E_USER_ERROR); }