Skip to content

Commit

Permalink
Adjust onBeforeDelete hook to only act when deleting from draft stage
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkleiner committed Apr 13, 2020
1 parent ff85481 commit 0226bb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Models/DataObjectTaxonomyTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ public function onBeforeDelete()
parent::onBeforeDelete();

if ($this->hasExtension(Versioned::class)) {
if ($this->canUnpublish()) {
$this->doUnpublish();
if (Versioned::get_stage() === Versioned::DRAFT) {
if ($this->canUnpublish()) {
$this->doUnpublish();
}
}
}
}
Expand Down

0 comments on commit 0226bb9

Please sign in to comment.