BUGFIX returning false from canDeleteFromLive() for a DataObject did not remove the Unpublish button from CMS, but the Unpublish action returned an error. Fixes #6731.

This commit is contained in:
Frank Mullenger 2011-10-08 17:14:54 +13:00
parent ce81740718
commit 916309e6c6

View File

@ -2045,7 +2045,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
return $actions;
}
if($this->isPublished() && $this->canPublish() && !$this->IsDeletedFromStage) {
if($this->isPublished() && $this->canPublish() && !$this->IsDeletedFromStage && $this->canDeleteFromLive()) {
// "unpublish"
$unpublish = FormAction::create('unpublish', _t('SiteTree.BUTTONUNPUBLISH', 'Unpublish'), 'delete');
$unpublish->describe(_t('SiteTree.BUTTONUNPUBLISHDESC', 'Remove this page from the published site'));