From 63366327137f36ccd218bf39f07d7481a94e498d Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 5 Sep 2013 16:06:58 +0200 Subject: [PATCH] Fall back to global locale state for link updates (#139) --- code/controller/TranslatableCMSMainExtension.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/controller/TranslatableCMSMainExtension.php b/code/controller/TranslatableCMSMainExtension.php index a187a1d..e209264 100644 --- a/code/controller/TranslatableCMSMainExtension.php +++ b/code/controller/TranslatableCMSMainExtension.php @@ -139,19 +139,23 @@ class TranslatableCMSMainExtension extends Extension { } 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) { - 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) { + $locale = $this->owner->Locale ? $this->owner->Locale : Translatable::get_current_locale(); $html = $this->LangForm()->forTemplate() . $html; } 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); } /**