mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
Copy values to keys in updateCMSFields' $alreadyTranslatedLocales since it's later used by LanguageDropdownField to exclude languages for which a translation already exists and LanguageDropdownField operates on array keys.
Also removed unused index/key variable $i from foreach loop that displays the existing translations.
This commit is contained in:
parent
515b02809d
commit
658cac4df6
@ -945,6 +945,7 @@ class Translatable extends DataExtension implements PermissionProvider {
|
|||||||
// and a translation. Include the current locale (record might not be saved yet).
|
// and a translation. Include the current locale (record might not be saved yet).
|
||||||
$alreadyTranslatedLocales = $this->getTranslatedLocales();
|
$alreadyTranslatedLocales = $this->getTranslatedLocales();
|
||||||
$alreadyTranslatedLocales[$this->owner->Locale] = $this->owner->Locale;
|
$alreadyTranslatedLocales[$this->owner->Locale] = $this->owner->Locale;
|
||||||
|
$alreadyTranslatedLocales = array_combine($alreadyTranslatedLocales, $alreadyTranslatedLocales);
|
||||||
|
|
||||||
if($originalRecord && $isTranslationMode) {
|
if($originalRecord && $isTranslationMode) {
|
||||||
$originalLangID = Session::get($this->owner->ID . '_originalLangID');
|
$originalLangID = Session::get($this->owner->ID . '_originalLangID');
|
||||||
@ -1009,7 +1010,7 @@ class Translatable extends DataExtension implements PermissionProvider {
|
|||||||
new HeaderField('ExistingTransHeader', _t('Translatable.EXISTING', 'Existing translations:'), 3)
|
new HeaderField('ExistingTransHeader', _t('Translatable.EXISTING', 'Existing translations:'), 3)
|
||||||
);
|
);
|
||||||
$existingTransHTML = '<ul>';
|
$existingTransHTML = '<ul>';
|
||||||
foreach($alreadyTranslatedLocales as $i => $langCode) {
|
foreach($alreadyTranslatedLocales as $langCode) {
|
||||||
$existingTranslation = $this->owner->getTranslation($langCode);
|
$existingTranslation = $this->owner->getTranslation($langCode);
|
||||||
if($existingTranslation) {
|
if($existingTranslation) {
|
||||||
$existingTransHTML .= sprintf('<li><a href="%s">%s</a></li>',
|
$existingTransHTML .= sprintf('<li><a href="%s">%s</a></li>',
|
||||||
|
Loading…
Reference in New Issue
Block a user