You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cancel draft changes UI component doesn't show up for draft changes on owned models
Cancel draft changes action is a really useful UI component. Unfortunately, it doesn't work with any owned models such as but not limited to content blocks which arguably is the majority case.
Tested on CMS 4.13.
Thoughts on solution
The only issue with this component is the display condition otherwise the functionality is fine and will work with nested models.
$stagesDiffer = $this->stagesDiffer(); <--- change this to stagesDifferRecursive()
// "rollback"if ($isOnDraft && $isPublished && $canEdit && $stagesDiffer) {
$moreOptions->push(
FormAction::create('rollback', _t(__CLASS__.'.BUTTONCANCELDRAFT', 'Cancel draft changes'))
->setDescription(_t(
'SilverStripe\\CMS\\Model\\SiteTree.BUTTONCANCELDRAFTDESC',
'Delete your draft and revert to the currently published page'
))
->addExtraClass('btn-secondary')
);
}
Cancel draft changes UI component doesn't show up for draft changes on owned models
Cancel draft changes action is a really useful UI component. Unfortunately, it doesn't work with any owned models such as but not limited to content blocks which arguably is the majority case.
Tested on CMS
4.13
.Thoughts on solution
The only issue with this component is the display condition otherwise the functionality is fine and will work with nested models.
Related PRs
silverstripe/silverstripe-versioned#328
The text was updated successfully, but these errors were encountered: