Fall back to global locale state for link updates (#139)

This commit is contained in:
Ingo Schommer 2013-09-05 16:06:58 +02:00
parent 15e9037c1b
commit 6336632713

View File

@ -139,19 +139,23 @@ class TranslatableCMSMainExtension extends Extension {
} }
function updateLink(&$link) { function updateLink(&$link) {
if($this->owner->Locale) $link = Controller::join_links($link, '?locale=' . $this->owner->Locale); $locale = $this->owner->Locale ? $this->owner->Locale : Translatable::get_current_locale();
if($locale) $link = Controller::join_links($link, '?locale=' . $locale);
} }
function updateLinkWithSearch(&$link) { function updateLinkWithSearch(&$link) {
if($this->owner->Locale) $link = Controller::join_links($link, '?locale=' . $this->owner->Locale); $locale = $this->owner->Locale ? $this->owner->Locale : Translatable::get_current_locale();
if($locale) $link = Controller::join_links($link, '?locale=' . $locale);
} }
function updateExtraTreeTools(&$html) { function updateExtraTreeTools(&$html) {
$locale = $this->owner->Locale ? $this->owner->Locale : Translatable::get_current_locale();
$html = $this->LangForm()->forTemplate() . $html; $html = $this->LangForm()->forTemplate() . $html;
} }
function updateLinkPageAdd(&$link) { function updateLinkPageAdd(&$link) {
if($this->owner->Locale) $link = Controller::join_links($link, '?Locale=' . $this->owner->Locale); $locale = $this->owner->Locale ? $this->owner->Locale : Translatable::get_current_locale();
if($locale) $link = Controller::join_links($link, '?Locale=' . $locale);
} }
/** /**