[BUGFIX] Also process array in InputSlugElement 00/58700/6
authorDaniel Goerz <daniel.goerz@posteo.de>
Thu, 25 Oct 2018 14:07:15 +0000 (16:07 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 27 Oct 2018 16:08:02 +0000 (18:08 +0200)
It is possible that the incoming $row contains an array
at the $languageField. This patch assures that the
$languageId can always be determined.

Resolves: #86734
Resolves: #86554
Relates: #86754
Releases: master
Change-Id: Ia2c8621cd935788f33a9b625ec0226a22e21b123
Reviewed-on: https://review.typo3.org/58700
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/Form/Element/InputSlugElement.php

index cfbf13b..cd67afd 100644 (file)
@@ -75,8 +75,11 @@ class InputSlugElement extends AbstractFormElement
         $parameterArray = $this->data['parameterArray'];
         $resultArray = $this->initializeResultArray();
 
-        $languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
-        $languageId = (int)($row[$languageField] ?? 0);
+        $languageId = 0;
+        if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && !empty($GLOBALS['TCA'][$table]['ctrl']['languageField'])) {
+            $languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
+            $languageId = (int)((is_array($row[$languageField]) ? $row[$languageField][0] : $row[$languageField]) ?? 0);
+        }
         $baseUrl = $this->getPrefix($this->data['site'], $languageId);
 
         $itemValue = $parameterArray['itemFormElValue'];