mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUG Use AbsoluteLiveLink() for CMS previews
It uses the correct live URLSegments for its parents
by setting the global Versioned reading mode correctly,
see 8a514d8b64
for detail.
This commit is contained in:
parent
8a514d8b64
commit
cec461b767
@ -573,22 +573,21 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
|
||||
$fields->push($idField = new HiddenField("ID", false, $id));
|
||||
// Necessary for different subsites
|
||||
$fields->push($liveURLField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
|
||||
$fields->push($liveURLField = new HiddenField("LiveLink"));
|
||||
$fields->push($stageURLField = new HiddenField("StageLink"));
|
||||
$fields->push($liveLinkField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
|
||||
$fields->push($liveLinkField = new HiddenField("LiveLink"));
|
||||
$fields->push($stageLinkField = new HiddenField("StageLink"));
|
||||
$fields->push(new HiddenField("TreeTitle", false, $record->TreeTitle));
|
||||
|
||||
$fields->push(new HiddenField('Sort','', $record->Sort));
|
||||
|
||||
if($record->ID && is_numeric( $record->ID ) ) {
|
||||
$liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree\".\"ID\" = $record->ID");
|
||||
if($liveRecord) {
|
||||
$liveURLField->setValue(Controller::join_links($liveRecord->AbsoluteLink(), '?stage=Live'));
|
||||
$liveLink = $record->getAbsoluteLiveLink();
|
||||
if($liveLink) $liveLinkField->setValue($liveLink);
|
||||
if(!$deletedFromStage) {
|
||||
$stageLink = Controller::join_links($record->AbsoluteLink(), '?stage=Stage');
|
||||
if($stageLink) $stageLinkField->setValue($stageLink);
|
||||
}
|
||||
}
|
||||
if(!$deletedFromStage) {
|
||||
$stageURLField->setValue(Controller::join_links($record->AbsoluteLink(), '?stage=Stage'));
|
||||
}
|
||||
|
||||
// Added in-line to the form, but plucked into different view by LeftAndMain.Preview.js upon load
|
||||
if(in_array('CMSPreviewable', class_implements($record)) && !$fields->fieldByName('SilverStripeNavigator')) {
|
||||
|
Loading…
Reference in New Issue
Block a user