mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX: Make AbsoluteLink() return a correct URL even after Director::setBaseURL() has been called.
This commit is contained in:
parent
62f8470de4
commit
2916b29287
@ -202,7 +202,10 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
}
|
||||
|
||||
function alternateAbsoluteLink() {
|
||||
return "http://" . $this->owner->Subsite()->domain() . $this->owner->Link();
|
||||
// Generate the existing absolute URL and replace the domain with the subsite domain.
|
||||
// This helps deal with Link() returning an absolute URL.
|
||||
$url = Director::absoluteURL($this->owner->Link());
|
||||
return preg_replace('/\/\/[^\/]+\//', '//' . $this->owner->Subsite()->domain() . '/', $url);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user