mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FEATURE: Add a function to give link to Live site (from r95948)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98102 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
19b745ad9e
commit
d64a9c28ca
@ -397,6 +397,25 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
return Controller::join_links($base, '/', $action);
|
return Controller::join_links($base, '/', $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the absolute URL for this page on the Live site.
|
||||||
|
*/
|
||||||
|
public function getAbsoluteLiveLink($includeStageEqualsLive = true) {
|
||||||
|
$live = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $this->ID);
|
||||||
|
|
||||||
|
if($live) {
|
||||||
|
$link = $live->AbsoluteLink();
|
||||||
|
|
||||||
|
if($includeStageEqualsLive) {
|
||||||
|
$link .= '?stage=Live';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a CSS identifier generated from this page's link.
|
* Return a CSS identifier generated from this page's link.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user