mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
BUGFIX Making sure that LeftAndMain->CurrentPage() respects language settings - was returning pages in different language from session after switching between languages in cms
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@70324 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
84f6f5d396
commit
ad5471afdb
@ -849,16 +849,17 @@ JS;
|
||||
}
|
||||
|
||||
public function EditForm() {
|
||||
$id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : $this->currentPageID();
|
||||
|
||||
if(!$id) return false;
|
||||
|
||||
if(is_numeric($id)) {
|
||||
$record = DataObject::get_by_id($this->stat('tree_class'), $id);
|
||||
if($record && !$record->canView()) return Security::permissionFailure($this);
|
||||
if(isset($_REQUEST['ID'])) {
|
||||
$record = DataObject::get_by_id($this->stat('tree_class'), $_REQUEST['ID']);
|
||||
} else {
|
||||
$record = $this->CurrentPage();
|
||||
}
|
||||
|
||||
if(!$record) return false;
|
||||
|
||||
if($record && !$record->canView()) return Security::permissionFailure($this);
|
||||
|
||||
return $this->getEditForm($id);
|
||||
return $this->getEditForm($record->ID);
|
||||
}
|
||||
|
||||
public function myprofile() {
|
||||
@ -905,7 +906,12 @@ JS;
|
||||
public function currentPage() {
|
||||
$id = $this->currentPageID();
|
||||
if($id && is_numeric($id)) {
|
||||
return DataObject::get_by_id($this->stat('tree_class'), $id);
|
||||
$page = DataObject::get_by_id($this->stat('tree_class'), $id);
|
||||
if(Translatable::is_enabled() && $page->Lang && $page->Lang != Translatable::current_lang()) {
|
||||
return false;
|
||||
} else {
|
||||
return $page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user