Fix 2.0 deprecations

This commit is contained in:
colymba 2014-05-11 22:23:03 +03:00
parent 38d05df2ec
commit 8836b2e389
3 changed files with 36 additions and 1 deletions

View File

@ -20,6 +20,11 @@ The master branch will try to be compatible with the latest SilverStripe release
* Download and copy module in SilverStripe root directory and name it whatever you want
* flush the manifest
## 2.0.0 deprecations
Major depractions in latest 2.0.0 release:
* The `GridFieldBulkImageUpload` has been renamed to `GridFieldBulkUpload`.
* `onBulkImageUpload` callback has been renamed to `onBulkUpload`
## Bulk Upload
Upload multiple images or files at once into DataObjects. Perfect for galleries and the like.

View File

@ -0,0 +1,25 @@
<?php
/**
* Legacy GridFieldBulkImageUpload component
*
* @deprecated 2.0 "GridFieldBulkImageUpload" is deprecated, use {@link GridFieldBulkUpload} class instead.
*
* @author colymba
* @package GridFieldBulkEditingTools
* @subpackage BulkUpload
*/
class GridFieldBulkImageUpload extends GridFieldBulkUpload
{
/**
* Component constructor
*
* @deprecated 2.0 "GridFieldBulkImageUpload" is deprecated, use {@link GridFieldBulkUpload} class instead.
*
* @param string $fileRelationName
*/
public function __construct($fileRelationName = null)
{
Deprecation::notice('2.0', '"GridFieldBulkImageUpload" is deprecated, use "GridFieldBulkUpload" class instead.');
return new GridFieldBulkUpload($fileRelationName);
}
}

View File

@ -91,7 +91,12 @@ class GridFieldBulkUpload_Request extends RequestHandler
$record->write();
// passes the current gridfield-instance to a call-back method on the new object
$record->extend("onBulkFileUpload", $this->gridField);
$record->extend("onBulkUpload", $this->gridField);
if ( $record->hasMethod('onBulkImageUpload') )
{
Deprecation::notice('2.0', '"onBulkImageUpload" callback is deprecated, use "onBulkUpload" instead.');
$record->extend("onBulkImageUpload", $this->gridField);
}
//get uploadField and process upload
$uploadField = $this->getUploadField();