Skip to content

Commit

Permalink
Change behavior remove method name in default/delete-upload-image
Browse files Browse the repository at this point in the history
  • Loading branch information
Eremin Michael committed Sep 4, 2018
1 parent 28302ba commit 9c5efcd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ public function actionDeleteUploadImage($id, $field)
$crud = $this->getCrud();
$model = $crud->findModel($id, 'update');

if (in_array($field, array_keys($model->getBehaviors()), true) && ($behavior = $model->getBehavior($field))) {
$behavior->beforeDelete();
if (in_array($field, array_keys($model->getBehaviors()), true) && ($behavior = $model->getBehavior($field)) && $behavior->hasMethod('removeImage')) {
$behavior->removeImage($field);
}

$model->updateAttributes([$field => '']);
Expand Down

0 comments on commit 9c5efcd

Please sign in to comment.