Commit 5bc83b77 authored by Georg Ringer's avatar Georg Ringer Committed by Benni Mack
Browse files

[FEATURE] Limit elements in Page module with default language and language mode

If the language mode is chosen in the page module and the default
language is selected, only the elements of the default language must be
chosen.

Resolves: #92460
Releases: master
Change-Id: Ieb472967e37d85095d0cdd7c1608c5f48adcfc49
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65970

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 241282f1
......@@ -264,6 +264,13 @@ class PageLayoutController
if (isset($this->availableLanguages[0])) {
$this->MOD_MENU['language'][0] = $this->availableLanguages[0]->getTitle();
}
// We need to add -1 (all) here so a possible -1 value in &SET['language'] will be respected
// by BackendUtility::getModuleData. Actually, this is only relevant if we are dealing with the
// "languages" mode, which however can only be determined, after the MOD_SETTINGS have been calculated
// by BackendUtility::getModuleData => chicken and egg problem. We therefore remove the -1 item from
// the menu again, as soon as we are able to determine the requested mode.
// @todo Replace the whole "mode" handling with some more robust solution
$this->MOD_MENU['language'][-1] = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:multipleLanguages');
}
// Initialize the available actions
$actions = $this->initActions();
......@@ -276,6 +283,10 @@ class PageLayoutController
) {
$this->MOD_SETTINGS['tt_content_showHidden'] = 1;
}
if ((int)$this->MOD_SETTINGS['function'] !== 2) {
// Remove -1 (all) from the module menu if not "languages" mode
unset($this->MOD_MENU['language'][-1]);
}
// Make action menu from available actions
$this->makeActionMenu($actions);
}
......
......@@ -202,6 +202,9 @@ class PageLayoutContext
public function getLanguagesToShow(): iterable
{
$selectedLanguageId = $this->drawingConfiguration->getSelectedLanguageId();
if ($selectedLanguageId === -1) {
return $this->getSiteLanguages();
}
if ($selectedLanguageId > 0) {
// A specific language is selected; compose a list of default language plus selected language
return [
......@@ -209,7 +212,7 @@ class PageLayoutContext
$this->site->getLanguageById($selectedLanguageId)
];
}
return $this->getSiteLanguages();
return [$this->site->getDefaultLanguage()];
}
public function getSiteLanguage(?int $languageId = null): SiteLanguage
......
.. include:: ../../Includes.txt
=================================================================
Feature: #92460 - Split default from all languages in page module
=================================================================
See :issue:`92460`
Description
===========
The view "Languages" in the page module allowes to render content elements of
the default language next to the ones of the selected language.
If the default language is chosen, instead of rendering all content elements
of all languages, now only the content elements of the default language are
rendered.
If an editor requires to see all content elements of all languages, the
option "All languages" can be selected.
Impact
======
Having many languages and many content elements can be a performance issue
in the page module which is now fixed.
Additionally the language view is now consistent with the column view.
.. index:: Backend, ext:backend
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