MINOR Only set current record in CMSMain->AddForm() if its not the homepage - not ideal, but root is the more likely default given the information at hand

This commit is contained in:
Ingo Schommer 2012-01-05 17:02:27 +01:00
parent 167bc045fe
commit 6dd0535442

View File

@ -1085,7 +1085,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
)
);
$parentField->setShowSearch(true);
$parentField->setValue(($record) ? $record->ID : null);
// CMSMain->currentPageID() automatically sets the homepage,
// which we need to counteract in the default selection (which should default to root, ID=0)
$homepageSegment = RootURLController::get_homepage_link();
if($record && $record->URLSegment != $homepageSegment) {
$parentField->setValue($record->ID);
}
$actions = new FieldList(
// $resetAction = new ResetFormAction('doCancel', _t('CMSMain.Cancel', 'Cancel')),