Skip to content
This repository
Browse code

NEW Add warning if viewed SiteTree object class is obsolete

  • Loading branch information...
commit 949507c3feeea41d5559b82c2456300c2afe5f40 1 parent d45dd34
Hamish Friedlander authored August 29, 2012

Showing 1 changed file with 15 additions and 1 deletion. Show diff stats Hide diff stats

  1. 16  code/model/SiteTree.php
16  code/model/SiteTree.php
@@ -1803,7 +1803,7 @@ function getCMSFields() {
1803 1803
 		if($this->HasBrokenLink || $this->HasBrokenFile) {
1804 1804
 			$statusMessage[] = _t('SiteTree.HASBROKENLINKS', "This page has broken links.");
1805 1805
 		}
1806  
-		
  1806
+
1807 1807
 		$dependentNote = '';
1808 1808
 		$dependentTable = new LiteralField('DependentNote', '<p></p>');
1809 1809
 		
@@ -1877,6 +1877,20 @@ function getCMSFields() {
1877 1877
 		
1878 1878
 		$tabMain->setTitle(_t('SiteTree.TABCONTENT', "Main Content"));
1879 1879
 
  1880
+		if($this->ObsoleteClassName) {
  1881
+			$obsoleteWarning = _t(
  1882
+				'SiteTree.OBSOLETECLASS',
  1883
+				"This page is of obsolete type {type}. Saving will reset it's type and you may lose data",
  1884
+				array('type' => $this->ObsoleteClassName)
  1885
+			);
  1886
+
  1887
+			$fields->addFieldToTab(
  1888
+				"Root.Main",
  1889
+				new LiteralField("ObsoleteWarningHeader", "<p class=\"message warning\">$obsoleteWarning</p>"),
  1890
+				"Title"
  1891
+			);
  1892
+		}
  1893
+
1880 1894
 		if(file_exists(BASE_PATH . '/install.php')) {
1881 1895
 			$fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader", 
1882 1896
 				"<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING", 

0 notes on commit 949507c

Please sign in to comment.
Something went wrong with that request. Please try again.