Skip to content

Commit

Permalink
Added compatibility with terminal42/contao-fineuploader, closes #54
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Aug 7, 2015
1 parent 8958ad7 commit 89c28c0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/MadeYourDay/Contao/CustomElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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'])) {

Expand Down

0 comments on commit 89c28c0

Please sign in to comment.