From 0883ceb69db84e42700713108f0abb98b536c34b Mon Sep 17 00:00:00 2001 From: Manuel Selbach <manuel_selbach@yahoo.de> Date: Thu, 8 Feb 2018 18:51:43 +0100 Subject: [PATCH] [BUGFIX] Make it possible to translate selectMultipleSideBySide For the default language it was possible to view the field, but on translating the dataset, the following exception is thrown: 'PHP Warning: Invalid argument supplied for foreach() in backend/Classes/Form/Element/SelectMultipleSideBySideElement.php line 66' As the defaultLanguageRow keeps to be "unparsed", the $selectedItems could be a comma separated string within the method TYPO3\CMS\Backend\Form\Element\SelectMultipleSideBySideElement::renderReadOnly if the TCA configuration of a field is set to 'defaultAsReadonly'. Resolves: #77155 Releases: master, 8.7, 7.6 Change-Id: Id9380fe3761e683352166565ed1a7e56f5e64190 Reviewed-on: https://review.typo3.org/55675 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../Classes/Form/Element/SelectMultipleSideBySideElement.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php index fdaf480baaa6..5bda89dea33a 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php @@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Form\Element; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\StringUtility; @@ -61,6 +62,9 @@ class SelectMultipleSideBySideElement extends AbstractFormElement } // Get the array with selected items: $itemsArray = $parameterArray['itemFormElValue'] ?: []; + if (!is_array($itemsArray)) { + $itemsArray = GeneralUtility::trimExplode(',', $itemsArray, true); + } // Perform modification of the selected items array: foreach ($itemsArray as $itemNumber => $itemValue) { -- GitLab