From ed127fabf3b6ef9f9c2111b8bd799e074c8bea3e Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 5 Oct 2009 20:41:54 +0000 Subject: [PATCH] BUGFIX Changed CMSMain->LangSelector() to always return a DropdownField, which ensures the 'Locale' parameter is always available to be passed along with ajax queries ENHANCEMENT Passing sitetree instance to CMSMain->LangSelector() in order to trigger canTranslate() filtering git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@88139 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSMain.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index da09a0d6..c70b287d 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -1259,21 +1259,17 @@ JS; * Called by the SSViewer when rendering the template. */ function LangSelector() { - $member = Member::currentUser(); //check to see if the current user can switch langs or not - if(Permission::checkMember($member, 'VIEW_LANGS')) { - $dropdown = new LanguageDropdownField( - 'LangSelector', - 'Language', - array(), - 'SiteTree', - 'Locale-English' - ); - $dropdown->setValue(Translatable::get_current_locale()); - return $dropdown; - } - - //user doesn't have permission to switch langs so just show a string displaying current language - return i18n::get_locale_name( Translatable::get_current_locale() ); + $member = Member::currentUser(); + $dropdown = new LanguageDropdownField( + 'LangSelector', + 'Language', + array(), + 'SiteTree', + 'Locale-English', + singleton('SiteTree') + ); + $dropdown->setValue(Translatable::get_current_locale()); + return $dropdown; } /**