[BUGFIX] Remove php warning for RTE classes without name 61/42361/2
authorManuel Selbach <manuel_selbach@yahoo.de>
Fri, 7 Aug 2015 10:14:56 +0000 (12:14 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 7 Aug 2015 10:58:53 +0000 (12:58 +0200)
Check if name within the configuration is set
so that no PHP warning: illigal offset will be thrown

Resolves: #68068
Releases: master,6.2
Change-Id: I781fa237aa696e6e9b03714f8e1aca4124589d5f
Reviewed-on: http://review.typo3.org/42361
Reviewed-by: Daniel Maier <dani-maier@gmx.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Daniel Maier <dani-maier@gmx.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/rtehtmlarea/Classes/Form/Element/RichTextElement.php

index b8d9890..d387146 100644 (file)
@@ -821,9 +821,13 @@ class RichTextElement extends AbstractFormElement {
                if (is_array($RTEProperties['classes.'])) {
                        foreach ($RTEProperties['classes.'] as $className => $conf) {
                                $className = rtrim($className, '.');
-                               $label = $this->getLanguageService()->sL(trim($conf['name']));
-                               $label = str_replace('"', '\\"', str_replace('\\\'', '\'', $label));
-                               $classesArray['labels'][$className] = trim($conf['name']) ? $label : '';
+
+                               $label = '';
+                               if (!empty($conf['name'])) {
+                                       $label = $this->getLanguageService()->sL(trim($conf['name']));
+                                       $label = str_replace('"', '\\"', str_replace('\\\'', '\'', $label));
+                               }
+                               $classesArray['labels'][$className] = $label;
                                $classesArray['values'][$className] = str_replace('\\\'', '\'', $conf['value']);
                                if (isset($conf['noShow'])) {
                                        $classesArray['noShow'][$className] = $conf['noShow'];