diff --git a/code/RelatedPageLink.php b/code/RelatedPageLink.php index b7f15c9..7bf800d 100644 --- a/code/RelatedPageLink.php +++ b/code/RelatedPageLink.php @@ -59,11 +59,24 @@ class RelatedPageLink extends DataObject { return $fields; } - function RelatedPageAdminLink() { - return '' . Convert::raw2xml($this->RelatedPage()->Title) . ''; + function RelatedPageAdminLink($master = false) { + $page = $master ? Dataobject::get_by_id("SiteTree", $this->MasterPageID) + : Dataobject::get_by_id("SiteTree", $this->RelatedPageID); + $otherPage = $master ? Dataobject::get_by_id("SiteTree", $this->RelatedPageID) + : Dataobject::get_by_id("SiteTree", $this->MasterPageID); + if(!$page) return; + + // Use cmsEditlink only when moving between different pages in the same subsite. + $classClause = ($page->SubsiteID == $otherPage->SubsiteID) ? ' class="cmsEditlink"' : ''; + return '" . Convert::raw2xml($page->Title) . ''; } - function AbsoluteLink() { - $url = $this->RelatedPage()->AbsoluteLink(); + function AbsoluteLink($master = false) { + $page = $master ? Dataobject::get_by_id("SiteTree", $this->MasterPageID) + : Dataobject::get_by_id("SiteTree", $this->RelatedPageID); + if(!$page) return; + + + $url = $page->AbsoluteLink(); return '' . Convert::raw2xml($url) . ''; } diff --git a/code/SiteTreeSubsites.php b/code/SiteTreeSubsites.php index 0413ce8..5df9b72 100644 --- a/code/SiteTreeSubsites.php +++ b/code/SiteTreeSubsites.php @@ -188,27 +188,24 @@ class SiteTreeSubsites extends SiteTreeDecorator { $related->setPermissions(array('add', 'edit', 'delete')); if($reverse) { - $text = '
In addition, this page is marked as related by the following pages:
In addition, this page is marked as related by the following pages:
'; foreach($reverse as $rpage) { - $text .= '