mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Delete problem fixing : When you delete an image with ImageField it only deletes the link not the image
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44099 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e78c785f0d
commit
0d4aa86789
@ -594,7 +594,9 @@ class Image_Uploader extends Controller {
|
||||
$this,
|
||||
'DeleteImageForm',
|
||||
new FieldSet(
|
||||
new HiddenField("Class", null, $this->urlParams['Class']),
|
||||
new HiddenField("ID", null, $this->urlParams['ID']),
|
||||
new HiddenField("Field", null, $this->urlParams['Field']),
|
||||
new HeaderField($title),
|
||||
new LabelField(
|
||||
sprintf(
|
||||
@ -677,8 +679,10 @@ class Image_Uploader extends Controller {
|
||||
* Delete the image referenced by this form.
|
||||
*/
|
||||
function delete($data, $form) {
|
||||
$image = $this->Image();
|
||||
$image->delete();
|
||||
$owner = DataObject::get_by_id( $data[ 'Class' ], $data[ 'ID' ] );
|
||||
$fieldName = $data[ 'Field' ] . 'ID';
|
||||
$owner->$fieldName = 0;
|
||||
$owner->write();
|
||||
Director::redirect($this->Link('iframe'));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user