mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Merge pull request #190 from silverstripe-rebelalliance/open/5971
NEW Add warning if viewed SiteTree object class is obsolete
This commit is contained in:
commit
af2c890168
@ -781,7 +781,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
$record->HasBrokenLink = 0;
|
||||
$record->HasBrokenFile = 0;
|
||||
|
||||
$record->writeWithoutVersion();
|
||||
if (!$record->ObsoleteClassName) $record->writeWithoutVersion();
|
||||
|
||||
// Update the class instance if necessary
|
||||
if(isset($data['ClassName']) && $data['ClassName'] != $record->ClassName) {
|
||||
|
@ -1877,6 +1877,20 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
||||
|
||||
$tabMain->setTitle(_t('SiteTree.TABCONTENT', "Main Content"));
|
||||
|
||||
if($this->ObsoleteClassName) {
|
||||
$obsoleteWarning = _t(
|
||||
'SiteTree.OBSOLETECLASS',
|
||||
"This page is of obsolete type {type}. Saving will reset it's type and you may lose data",
|
||||
array('type' => $this->ObsoleteClassName)
|
||||
);
|
||||
|
||||
$fields->addFieldToTab(
|
||||
"Root.Main",
|
||||
new LiteralField("ObsoleteWarningHeader", "<p class=\"message warning\">$obsoleteWarning</p>"),
|
||||
"Title"
|
||||
);
|
||||
}
|
||||
|
||||
if(file_exists(BASE_PATH . '/install.php')) {
|
||||
$fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader",
|
||||
"<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING",
|
||||
|
Loading…
Reference in New Issue
Block a user