Commit e0093889 authored by Christina Hauk's avatar Christina Hauk Committed by Tymoteusz Motylewski
Browse files

[BUGFIX] Hide language switcher if record has no default translation

Disable further language menu options in free mode. If language record
doesn't have a record in the default language there are no more options
in the language menu needed.

Resolves: #72797
Releases: master, 7.6
Change-Id: Ic5211f99c3c53f3097057ba580e3394896b81170
Reviewed-on: https://review.typo3.org/50298


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Josef Glatz's avatarJosef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz's avatarJosef Glatz <josef.glatz@typo3.org>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Tested-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
parent a1f741dd
......@@ -1611,28 +1611,36 @@ class EditDocumentController extends AbstractModule
if ($this->getBackendUser()->checkLanguageAccess($lang['uid'])) {
$newTranslation = isset($rowsByLang[$lang['uid']]) ? '' : ' [' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.new')) . ']';
// Create url for creating a localized record
$addOption = true;
if ($newTranslation) {
$redirectUrl = BackendUtility::getModuleUrl('record_edit', [
'justLocalized' => $table . ':' . $rowsByLang[0]['uid'] . ':' . $lang['uid'],
'returnUrl' => $this->retUrl
]);
$href = BackendUtility::getLinkToDataHandlerAction(
'&cmd[' . $table . '][' . $rowsByLang[0]['uid'] . '][localize]=' . $lang['uid'],
$redirectUrl
);
if ($currentLanguage === 0) {
$href = BackendUtility::getLinkToDataHandlerAction(
'&cmd[' . $table . '][' . $rowsByLang[0]['uid'] . '][localize]=' . $lang['uid'],
$redirectUrl
);
} else {
$addOption = false;
}
} else {
$href = BackendUtility::getModuleUrl('record_edit', [
'edit[' . $table . '][' . $rowsByLang[$lang['uid']]['uid'] . ']' => 'edit',
'returnUrl' => $this->retUrl
]);
}
$menuItem = $languageMenu->makeMenuItem()
->setTitle($lang['title'] . $newTranslation)
->setHref($href);
if ((int)$lang['uid'] === $currentLanguage) {
$menuItem->setActive(true);
if ($addOption) {
$menuItem = $languageMenu->makeMenuItem()
->setTitle($lang['title'] . $newTranslation)
->setHref($href);
if ((int)$lang['uid'] === $currentLanguage) {
$menuItem->setActive(true);
}
$languageMenu->addMenuItem($menuItem);
}
$languageMenu->addMenuItem($menuItem);
}
}
$this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($languageMenu);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment