mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
BUGFIX Explicitly setting "lang" as a GET var when getting a page within the CMS (if the language chooser DOM object is available, hence translation mode is enabled). Used in CMSMain->init() to set the "current language". (merged from branches/translatable in r64523, thanks wakeless!)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@69899 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
559a4e5899
commit
4cf2ee5e38
@ -79,6 +79,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
public function init() {
|
||||
parent::init();
|
||||
|
||||
if(Translatable::is_enabled()) {
|
||||
$this->Lang = $this->requestParams["lang"] ? $this->requestParams["lang"] : Translatable::default_lang();
|
||||
Translatable::set_reading_lang($this->Lang);
|
||||
}
|
||||
|
||||
// collect languages for TinyMCE spellchecker plugin
|
||||
if(Translatable::is_enabled()) {
|
||||
$spellcheckLangs = Translatable::get_existing_content_languages();
|
||||
@ -472,6 +477,7 @@ JS;
|
||||
*/
|
||||
public function getNewItem($id, $setID = true) {
|
||||
list($dummy, $className, $parentID, $suffix) = array_pad(explode('-',$id),4,null);
|
||||
|
||||
if(Translatable::is_enabled()) {
|
||||
if (!Translatable::is_default_lang()) {
|
||||
$originalItem = Translatable::get_original($className,Session::get("{$id}_originalLangID"));
|
||||
@ -483,6 +489,7 @@ JS;
|
||||
return $originalItem;
|
||||
}
|
||||
}
|
||||
|
||||
$newItem = new $className();
|
||||
|
||||
if( !$suffix ) {
|
||||
|
@ -300,6 +300,12 @@ CMSRightForm.prototype = {
|
||||
var sep = (SiteTreeHandlers.loadPage_url.indexOf('?') == -1) ? '?' : '&';
|
||||
url = SiteTreeHandlers.loadPage_url + sep + 'ID=' + id;
|
||||
}
|
||||
|
||||
// used to set language in CMSMain->init()
|
||||
var lang = $('LangSelector') ? $F('LangSelector') : null;
|
||||
if(lang) {
|
||||
url += '&lang='+lang;
|
||||
}
|
||||
|
||||
statusMessage("loading...");
|
||||
this.loadURLFromServer(url);
|
||||
|
Loading…
x
Reference in New Issue
Block a user