Deprecation: #111336 - Legacy language mode and overlay type of LanguageAspect
See forge#111336
Description
The following methods of
\TYPO3\ have been marked as deprecated
and will be removed in TYPO3 v16.0:
LanguageAspect->get Legacy Language Mode () LanguageAspect->get Legacy Overlay Type ()
The same applies to the corresponding aspect properties
legacy and
legacy, for example when
accessed via
$context->get.
Both methods were introduced in TYPO3 v9 to map the language aspect to the
former TypoScript options
config. and
config., which have been removed since. For
a language aspect created from a site language, the legacy language mode is
always
'content_, so it does not carry any information.
For the same reason, the "page not found" reason
\TYPO3\
(
'language.) has been marked as deprecated and will be removed
in TYPO3 v16.0. TYPO3 used it only for the legacy language mode
'strict'
, which never applies to site languages, so this reason is
not passed to error handlers anymore.
Impact
Calling one of the methods, or accessing one of the aspect properties, triggers a PHP deprecation warning. The methods and properties continue to work as before until they are removed in TYPO3 v16.0.
Using the constant
Page
does not trigger a deprecation warning.
Affected installations
TYPO3 installations with custom extensions that call
Language or
Language, or that read the aspect
properties
legacy or
legacy.
TYPO3 installations with custom error handlers or middlewares that check for
the reason
Page.
The extension scanner reports calls of the methods as a weak match and usages of the constant as a strong match. Access to the aspect properties is not detected.
Migration
Remove checks for
Page.
A page that is not available in the requested language and its fallback
languages is reported with
Page,
or with
Page
if the page is configured to be hidden when it is not translated.
Use
Language with the constants
Language,
Language
and
Language instead of the legacy
overlay type, and
Language to check whether
records are overlaid at all.
Use
Language instead of the legacy language
mode to find out which languages are used as fallback.
if ($languageAspect->getLegacyOverlayType() === 'hideNonTranslated') {
// ...
}
use TYPO3\CMS\Core\Context\LanguageAspect;
if ($languageAspect->getOverlayType() === LanguageAspect::OVERLAYS_ON_WITH_FLOATING) {
// ...
}