From 89c28c04b11b8b112afcb3b2778921df6f9cfc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Auswo=CC=88ger?= Date: Fri, 7 Aug 2015 15:32:04 +0200 Subject: [PATCH] Added compatibility with terminal42/contao-fineuploader, closes #54 --- src/MadeYourDay/Contao/CustomElements.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/MadeYourDay/Contao/CustomElements.php b/src/MadeYourDay/Contao/CustomElements.php index 56fe23e..79e869c 100644 --- a/src/MadeYourDay/Contao/CustomElements.php +++ b/src/MadeYourDay/Contao/CustomElements.php @@ -138,11 +138,10 @@ public function loadCallback($value, $dc) $value = $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['default']; } - if ( - version_compare(VERSION, '3.2', '>=') && - $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fileTree' && - $value - ) { + if (version_compare(VERSION, '3.2', '>=') && $value && ( + $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fileTree' + || $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fineUploader' + )) { // Multiple files if (substr($value, 0, 2) === 'a:') { $value = serialize(array_map(function($value) { @@ -288,10 +287,10 @@ public function saveCallback($value, $dc) return; } - if ( - version_compare(VERSION, '3.2', '>=') && + if (version_compare(VERSION, '3.2', '>=') && ( $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fileTree' - ) { + || $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['inputType'] === 'fineUploader' + )) { if (trim($value)) { if (strlen($value) === 16) { $value = \String::binToUuid($value); @@ -1491,7 +1490,10 @@ protected function convertDataForImportExportParseFields($import, $data, $config } // UUIDs to paths and vice versa - else if ($fieldConfig['inputType'] === 'fileTree' && $value) { + else if ($value && ( + $fieldConfig['inputType'] === 'fileTree' + || $fieldConfig['inputType'] === 'fineUploader' + )) { if (empty($fieldConfig['eval']['multiple'])) {