Issue Bug Closed

#92248Extend sys_file_metadata with RTE field throws exception with language id > 0

Chris Müller 09/09/20, 18:33 updated 12/22/20, 11:06

Description

I extended the sys_file_metadata table with a field which enables the RTE. When I now want to translate a metadata record in File > Filelist (language id > 0) the following exception is thrown:

Return value of TYPO3\CMS\RteCKEditor\Form\Element\RichTextElement::getLanguageIsoCodeOfContent() must be of the type string, null returned
in /var/www/html/public/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php line 196

The reason is:
In Filelist the site languages are not known, so only -1 and 0 are available ($currentLanguageUid is 1 in my case):

$contentLanguage = $this->data['systemLanguageRows'][$currentLanguageUid]['iso'];

returns null, which violates the method return type (string).

A solution can be to return “en” as language for RTE when the current language is not found.

Reviews 2