From 71302493c166c80a855ceefebb1fdb1ca2ab2f58 Mon Sep 17 00:00:00 2001 From: touffies Date: Fri, 29 Nov 2013 14:29:12 +0100 Subject: [PATCH] Add a new method to get the site URL based on the language --- .../Controller/Admin/BaseAdminController.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php index 849438539..65d2e07fb 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -302,6 +302,23 @@ class BaseAdminController extends BaseController return $this->getCurrentEditionLang()->getLocale(); } + /** + * A simple helper to get the URL based on the language. + */ + protected function getUrlLanguage($locale = null) + { + // Check if the functionality is activated + if(!ConfigQuery::read("one_domain_foreach_lang", false)) + return; + + // If we don't have a locale value, use the locale value in the session + if(!$locale) + $locale = $this->getCurrentEditionLocale(); + + return LangQuery::create()->findOneByLocale($locale)->getUrl(); + } + + /** * Return the current list order identifier for a given object name, * updating in using the current request.