mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT Using standard LanguageDropdownField in CMSMain->LangSelector()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@76840 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9da24cdfb5
commit
e99ef98e89
@ -1405,19 +1405,7 @@ JS;
|
|||||||
function LangSelector() {
|
function LangSelector() {
|
||||||
$member = Member::currentUser(); //check to see if the current user can switch langs or not
|
$member = Member::currentUser(); //check to see if the current user can switch langs or not
|
||||||
if(Permission::checkMember($member, 'VIEW_LANGS')) {
|
if(Permission::checkMember($member, 'VIEW_LANGS')) {
|
||||||
$allKey = _t('Form.LANGAOTHER', "Other languages");
|
return new LanguageDropdownField('LangSelector', 'Language', array(), 'SiteTree', 'Locale-English');
|
||||||
$all = i18n::get_common_locales(); //all languages
|
|
||||||
$used = Translatable::get_existing_content_languages(); //languages currently in use
|
|
||||||
if( $used && count($used) ) {
|
|
||||||
foreach($used as $index => $code) {
|
|
||||||
if(!$code) continue;
|
|
||||||
$available[$index] = $all[$index];
|
|
||||||
unset($all[$index]);
|
|
||||||
}
|
|
||||||
$langs[ _t('Form.LANGAVAIL', "Available languages") ] = (isset( $available )) ? $available : array();
|
|
||||||
}
|
|
||||||
$langs[ _t('Form.LANGAOTHER', "Other languages") ] = $all;
|
|
||||||
return new GroupedDropdownField('LangSelector', 'Language', $langs, Translatable::current_locale());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//user doesn't have permission to switch langs so just show a string displaying current language
|
//user doesn't have permission to switch langs so just show a string displaying current language
|
||||||
|
Loading…
Reference in New Issue
Block a user