[BUGFIX] Better fallback configuration for CKEDITOR 20/51820/8
authorAnders Kostending <aha@systime.dk>
Fri, 24 Feb 2017 09:04:35 +0000 (10:04 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 1 Mar 2017 10:49:52 +0000 (11:49 +0100)
If in TCA ['config']['richtextConfiguration'] is not set,
fall back to 'default' configuration.

Resolves: #79756
Releases: master
Change-Id: I83d90a8bb52cec84257809674b46fdf69f6fb815
Reviewed-on: https://review.typo3.org/51820
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Configuration/Richtext.php

index 433acdd..a8795b5 100644 (file)
@@ -54,13 +54,11 @@ class Richtext
         // together with pageTS, this way it can be overridden and understood in RteHtmlParser.
         // However, all other parts of the core will depend on the non-dotted syntax (coming from Yaml directly)
 
-        $usePreset = '';
-        $configuration = [];
-        // Check if a configuration preset file is added
-        if (isset($tcaFieldConf['richtextConfiguration'])) {
-            $usePreset = $tcaFieldConf['richtextConfiguration'];
-            $configuration = $this->loadConfigurationFromPreset($tcaFieldConf['richtextConfiguration']);
+        if (!isset($tcaFieldConf['richtextConfiguration'])) {
+            $tcaFieldConf['richtextConfiguration'] = 'default';
         }
+        $usePreset = $tcaFieldConf['richtextConfiguration'];
+        $configuration = $this->loadConfigurationFromPreset($tcaFieldConf['richtextConfiguration']);
 
         // Overload with PageTSconfig configuration
         // First use RTE.default
@@ -108,18 +106,14 @@ class Richtext
      */
     protected function loadConfigurationFromPreset(string $presetName = ''): array
     {
-        $configuration = [
-            'processing' => [
-                'mode' => 'default'
-            ]
-        ];
+        $configuration = [];
         if (!empty($presetName) && isset($GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets'][$presetName])) {
             $fileLoader = GeneralUtility::makeInstance(YamlFileLoader::class);
             $configuration = $fileLoader->load($GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets'][$presetName]);
-        }
-        // For future versions, you should however rely on the "processing" key and not the "proc" key.
-        if (is_array($configuration['processing'])) {
-            $configuration['proc.'] = $this->convertPlainArrayToTypoScriptArray($configuration['processing']);
+            // For future versions, you should however rely on the "processing" key and not the "proc" key.
+            if (is_array($configuration['processing'])) {
+                $configuration['proc.'] = $this->convertPlainArrayToTypoScriptArray($configuration['processing']);
+            }
         }
         return $configuration;
     }