Permalink
Browse files

MINOR Fall back to homepage record for CMSMain->PreviewLink()

  • Loading branch information...
1 parent 38db63c commit 17131f7a2a0352eaa718a5d08d861f817ca2c991 @chillu chillu committed Jul 6, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 code/controller/CMSMain.php
@@ -497,6 +497,19 @@ function RootForm() {
return $form;
}
+
+ public function currentPageID() {
+ $id = parent::currentPageID();
+
+ // Fall back to homepage record
+ if(!$id) {
+ $homepageSegment = RootURLController::get_homepage_link();
+ $homepageRecord = DataObject::get_one('SiteTree', sprintf('"URLSegment" = \'%s\'', $homepageSegment));
+ if($homepageRecord) $id = $homepageRecord->ID;
+ }
+
+ return $id;
+ }
//------------------------------------------------------------------------------------------//
// Data saving handlers

0 comments on commit 17131f7

Please sign in to comment.