mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX: Tracking links across subsites is a special case (from r87260) (from r96280)
This commit is contained in:
parent
60c69f387e
commit
ef85d4bd8d
@ -190,17 +190,41 @@ class SiteTreeSubsites extends SiteTreeDecorator {
|
||||
$related->setPermissions(array('add', 'edit', 'delete'));
|
||||
|
||||
if($reverse) {
|
||||
$text = '<p>In addition, this page is marked as related by the following pages: </p><p>';
|
||||
$text = '<p>In addition, this page is marked as related by the following pages: </p><ul>';
|
||||
foreach($reverse as $rpage) {
|
||||
$text .= $rpage->RelatedPageAdminLink(true) . " - " . $rpage->AbsoluteLink(true) . "<br />\n";
|
||||
$text .= '<ul><a href="admin/show/' . $rpage->ID . '">' . $rpage->Title . '</a></ul>';
|
||||
}
|
||||
$text .= '</p>';
|
||||
$text .= '</ul>';
|
||||
|
||||
$tab->push(new LiteralField('ReverseRelated', $text));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function ReverseRelated() {
|
||||
$return = new DataObjectSet();
|
||||
$links = DataObject::get('RelatedPageLink', 'RelatedPageID = ' . $this->owner->ID);
|
||||
if($links) foreach($links as $link) {
|
||||
if($link->MasterPage()->exists()) {
|
||||
$return->push($link->MasterPage());
|
||||
}
|
||||
}
|
||||
|
||||
return $return->Count() > 0 ? $return : false;
|
||||
}
|
||||
|
||||
function NormalRelated() {
|
||||
$return = new DataObjectSet();
|
||||
$links = DataObject::get('RelatedPageLink', 'MasterPageID = ' . $this->owner->ID);
|
||||
if($links) foreach($links as $link) {
|
||||
if($link->RelatedPage()->exists()) {
|
||||
$return->push($link->RelatedPage());
|
||||
}
|
||||
}
|
||||
|
||||
return $return->Count() > 0 ? $return : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the RelatedPageLink objects that are reverse-associated with this page.
|
||||
*/
|
||||
@ -336,6 +360,14 @@ class SiteTreeSubsites extends SiteTreeDecorator {
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a piece of text to keep DataObject cache keys appropriately specific
|
||||
*/
|
||||
function cacheKeyComponent() {
|
||||
return 'subsite-'.Subsite::currentSubsiteID();
|
||||
}
|
||||
|
||||
function augmentSyncLinkTracking() {
|
||||
// Set LinkTracking appropriately
|
||||
$links = HTTP::getLinksIn($this->owner->Content);
|
||||
@ -366,13 +398,6 @@ class SiteTreeSubsites extends SiteTreeDecorator {
|
||||
|
||||
$this->owner->CrossSubsiteLinkTracking()->setByIDList($linkedPages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a piece of text to keep DataObject cache keys appropriately specific
|
||||
*/
|
||||
function cacheKeyComponent() {
|
||||
return 'subsite-'.Subsite::currentSubsiteID();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user