mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Filter both 'available' and 'new' languages in LanguageDropdownField for canTranslate() permissions
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88138 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
54824945f5
commit
a0fd987b29
@ -35,11 +35,21 @@ class LanguageDropdownField extends GroupedDropdownField {
|
|||||||
($allowedLocales && !in_array($locale, $allowedLocales))
|
($allowedLocales && !in_array($locale, $allowedLocales))
|
||||||
|| ($excludeLocales && in_array($locale, $excludeLocales))
|
|| ($excludeLocales && in_array($locale, $excludeLocales))
|
||||||
|| ($usedLocalesWithTitle && array_key_exists($locale, $usedLocalesWithTitle))
|
|| ($usedLocalesWithTitle && array_key_exists($locale, $usedLocalesWithTitle))
|
||||||
|| ($instance && !$instance->canTranslate(null, $locale))
|
|
||||||
) {
|
) {
|
||||||
unset($allLocalesWithTitle[$locale]);
|
unset($allLocalesWithTitle[$locale]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// instance specific permissions
|
||||||
|
foreach($allLocalesWithTitle as $locale => $localeTitle) {
|
||||||
|
if($instance && !$instance->canTranslate(null, $locale)) {
|
||||||
|
unset($allLocalesWithTitle[$locale]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($usedLocalesWithTitle as $locale => $localeTitle) {
|
||||||
|
if($instance && !$instance->canTranslate(null, $locale)) {
|
||||||
|
unset($usedLocalesWithTitle[$locale]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sort by title (array value)
|
// Sort by title (array value)
|
||||||
asort($allLocalesWithTitle);
|
asort($allLocalesWithTitle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user