/** * Flatten result value from FileProcessor * * The value can be a File, Folder or boolean * * @param bool|\TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $result * @return bool|string|array */ protected function flattenResultDataValue($result) { if ($result instanceof \TYPO3\CMS\Core\Resource\File) { $thumbUrl = ''; if (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $result->getExtension())) { $processedFile = $result->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array()); if ($processedFile) { $thumbUrl = $processedFile->getPublicUrl(true); } } $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $result = array_merge($result->toArray(), array('date' => BackendUtility::date($result->getModificationTime()), 'icon' => $iconFactory->getIconForFileExtension($result->getExtension(), Icon::SIZE_SMALL)->render(), 'thumbUrl' => $thumbUrl)); } elseif ($result instanceof \TYPO3\CMS\Core\Resource\Folder) { $result = $result->getIdentifier(); } return $result; }