mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
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
This commit is contained in:
parent
ee340bc99e
commit
ed127fabf3
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user