ENHANCEMENT Added isMainSite() to SiteTree decorator for subsites so it can be checked if we're currently viewing the main site or a sub-site

This commit is contained in:
Sean Harvey 2009-07-14 06:42:31 +00:00
parent 10d1ac7c42
commit 65dfa20031

View File

@ -39,6 +39,15 @@ class SiteTreeSubsites extends DataObjectDecorator {
);
}
/**
* Check if we're currently looking at the main site.
* @return boolean TRUE main site | FALSE sub-site
*/
function isMainSite() {
if($this->owner->SubsiteID == 0) return true;
return false;
}
/**
* Update any requests to limit the results to the current site
*/
@ -212,6 +221,7 @@ class SiteTreeSubsites extends DataObjectDecorator {
$url = Director::absoluteURL($this->owner->Link());
return preg_replace('/\/\/[^\/]+\//', '//' . $this->owner->Subsite()->domain() . '/', $url);
}
}
?>