FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
189 stars 228 forks source link

DEPRECATION in TYPO3v12: SiteLanguage->getTwoLetterIsoCode() #1891

Open cstrizzolo opened 10 months ago

cstrizzolo commented 10 months ago

I have checked that the bug exists in the dev-development branch Yes

I have checked that there are no already open issues or recently closed issues about this bug Yes

Describe the bug The following deprecation notice gets added to the deprecation log on TYPO3 v.12.4.8 using vhs v.7.0.1:

Mon, 27 Nov 2023 14:52:50 +0100 [NOTICE] request="e58ca3868b72f" component="TYPO3.CMS.deprecations": Core: Error handler (FE): TYPO3 Deprecation Notice: SiteLanguage->getTwoLetterIsoCode() will be removed in TYPO3 v13.0. Use SiteLanguage->getLocale()->getLanguageCode() instead. in /(...)/typo3_src-12.4.8/typo3/sysext/core/Classes/Site/Entity/SiteLanguage.php line 275

To Reproduce Although I am not completely sure, I guess this happens when using the following tag in the Fluid templates:

<v:page.languageMenu defaultLanguageLabel="Italian" defaultIsoFlag="it" flagImageType="png" as="menu">

In any case, the deprecated function is used on line 430 in Classes/ViewHelpers/Page/LanguageMenuViewHelper.php:

$result[$language->getLanguageId()] = [
                'label' => $label,
                'iso' => $language->getTwoLetterIsoCode(),
                'flagIdentifier' => $flag
];

Expected behavior No deprecation notices.