mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
NEW SiteTree->PreviewLink() for fine grained URL control
This commit is contained in:
parent
f9504ee983
commit
76aeec70e7
@ -246,7 +246,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
|
||||
}
|
||||
|
||||
public function getLink() {
|
||||
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage');
|
||||
return Controller::join_links($this->record->PreviewLink(), '?stage=Stage');
|
||||
}
|
||||
|
||||
public function canView($member = null) {
|
||||
@ -299,7 +299,7 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
|
||||
}
|
||||
|
||||
public function getLink() {
|
||||
return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live');
|
||||
return Controller::join_links($this->record->PreviewLink(), '?stage=Live');
|
||||
}
|
||||
|
||||
public function canView($member = null) {
|
||||
@ -333,7 +333,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
||||
static $priority = 40;
|
||||
|
||||
public function getHTML() {
|
||||
$this->recordLink = $this->record->AbsoluteLink();
|
||||
$this->recordLink = $this->record->PreviewLink();
|
||||
return "<a class=\"ss-ui-button\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
||||
}
|
||||
|
||||
public function getLink() {
|
||||
return $this->record->AbsoluteLink() . '?archiveDate=' . $this->record->LastEdited;
|
||||
return $this->record->PreviewLink() . '?archiveDate=' . $this->record->LastEdited;
|
||||
}
|
||||
|
||||
public function canView($member = null) {
|
||||
|
@ -412,6 +412,18 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
||||
return Director::absoluteURL($this->Link($action));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base link used for previewing. Defaults to absolute URL,
|
||||
* in order to account for domain changes, e.g. on multi site setups.
|
||||
* Does not contain hints about the stage, see {@link SilverStripeNavigator} for details.
|
||||
*
|
||||
* @param string $action See {@link Link()}
|
||||
* @return string
|
||||
*/
|
||||
public function PreviewLink($action = null) {
|
||||
return $this->AbsoluteLink($action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the link for this {@link SiteTree} object relative to the SilverStripe root.
|
||||
|
Loading…
Reference in New Issue
Block a user