Skip to content

Commit

Permalink
hide delete for new records
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed Oct 3, 2019
1 parent 57eb1fd commit 9ac2cd1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/SoftDeletable.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ public function updateCMSActions(FieldList $actions)
// Need CustomAction (from lekoala/silverstripe-base) for this to work;
return;
}

// Hide delete for new records
if (!$this->owner->ID) {
return;
}
if ($this->owner->Deleted) {
$undoDelete = new CustomAction('undoDelete', 'Undo Delete');
$actions->push($undoDelete);
Expand Down

0 comments on commit 9ac2cd1

Please sign in to comment.