Project

General

Profile

Actions

Bug #101401

closed

Epic #99669: CKEditor5 Collection

Undefined array key "ui" in vendor/typo3/cms-rte-ckeditor/Classes/Form/Element/RichTextElement.php

Added by Georg Tiefenbrunn 11 months ago. Updated 9 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2023-07-20
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Revision 44d96519 added two unchecked array key access (RichTextElement.php L193 and L198)

        $uiLanguage = $ckeditorConfiguration['options']['language']['ui'];
        if ($this->translationExists($uiLanguage)) {
            $resultArray['javaScriptModules'][] = JavaScriptModuleInstruction::create('@typo3/ckeditor5/translations/' . $uiLanguage . '.js');
        }

        $contentLanguage = $ckeditorConfiguration['options']['language']['content'];
        if ($this->translationExists($contentLanguage)) {
            $resultArray['javaScriptModules'][] = JavaScriptModuleInstruction::create('@typo3/ckeditor5/translations/' . $contentLanguage . '.js');
        }

$ckeditorConfiguration is generated in RichTextElement::prepareConfigurationForEditor() and is based on the editor.config array from the RTE yaml files.

CKeditor's text part language feature uses the config.language.textPartLanguage configuration option. This feature is currently missing (see #101128), but if configured in RTE yaml causes prepareConfigurationForEditor() to assume the UI language of the editor if hard-coded (empty($configuration['language']) is checked instead of empty($configuration['language']['ui'] ?? null)).

RTE configuration causing exception

editor:
  config:
    language:
      textPartLanguage:
        - { title: 'English', languageCode: 'en' }
        - { title: 'French', languageCode: 'fr' }
        - { title: 'German', languageCode: 'de' }

Workaround

editor:
  config:
    language:
      # Use hard-coded UI language
      ui: en
      textPartLanguage:
        - { title: 'English', languageCode: 'en' }
        - { title: 'French', languageCode: 'fr' }
        - { title: 'German', languageCode: 'de' }

Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Feature #101128: CKeditor implement bidi and language Plugin againUnder Review2023-06-20

Actions
Related to TYPO3 Core - Bug #100873: CKEditor language files missingResolved2023-05-13

Actions
Actions

Also available in: Atom PDF