From 98f1f28ff2305dbd597bd9d68ff5ab32ad7dc4ca Mon Sep 17 00:00:00 2001 From: Stefan Froemken <froemken@gmail.com> Date: Thu, 24 Oct 2019 18:13:55 +0200 Subject: [PATCH] [FEATURE] Add stdWrap properties to references in FilesProcessor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add stdWrap properties to references like it is done in FilesContentObject. That way it is possible to select FileResources from rootline. Resolves: #78347 Releases: master Change-Id: I257d063ad39f8bab531bd034150b1d556f12c56b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62098 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Jörg Bösche <typo3@joergboesche.de> Tested-by: Tobi Kretschmann <tobi@tobishome.de> Tested-by: Susanne Moog <look@susi.dev> Reviewed-by: Jörg Bösche <typo3@joergboesche.de> Reviewed-by: Tobi Kretschmann <tobi@tobishome.de> Reviewed-by: Felix P. <f.pachowsky@neusta.de> Reviewed-by: Susanne Moog <look@susi.dev> --- ...7-AddStdWrapPropertiesToFilesProcessor.rst | 38 +++++++++++++++++++ .../Classes/DataProcessing/FilesProcessor.php | 27 ++++++++----- 2 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-78347-AddStdWrapPropertiesToFilesProcessor.rst diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-78347-AddStdWrapPropertiesToFilesProcessor.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-78347-AddStdWrapPropertiesToFilesProcessor.rst new file mode 100644 index 000000000000..5cf28d2dea99 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-78347-AddStdWrapPropertiesToFilesProcessor.rst @@ -0,0 +1,38 @@ +.. include:: ../../Includes.txt + +========================================================== +Feature: #78347 - Add StdWrap properties to FilesProcessor +========================================================== + +See :issue:`78347` + +Description +=========== + +Add stdWrap properties to FLUIDTEMPLATEs FilesProcessor as it is possible in FilesContentObject, too. +That way you can implement slide-functionality on rootline for file resources. + + +TypoScript dataProcessing example with FilesProcessor +----------------------------------------------------- + +.. code-block:: typoscript + + page.10 = FLUIDTEMPLATE + page.10.dataProcessing { + 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + 10 { + references.data = levelmedia: -1, slide + as = myfiles + } + + +Impact +====== + +The FilesProcessor can slide up and down the rootline to collect images for FLUID templates. +One usual feature is to use images attached to pages and use them up and down the page tree +for header images in frontend. + + +.. index:: TypoScript, Frontend diff --git a/typo3/sysext/frontend/Classes/DataProcessing/FilesProcessor.php b/typo3/sysext/frontend/Classes/DataProcessing/FilesProcessor.php index cd7dd1823b17..f705e2677d90 100644 --- a/typo3/sysext/frontend/Classes/DataProcessing/FilesProcessor.php +++ b/typo3/sysext/frontend/Classes/DataProcessing/FilesProcessor.php @@ -58,16 +58,25 @@ class FilesProcessor implements DataProcessorInterface $fileCollector = GeneralUtility::makeInstance(FileCollector::class); // references / relations - if (!empty($processorConfiguration['references.'])) { - $referenceConfiguration = $processorConfiguration['references.']; - $relationField = $cObj->stdWrapValue('fieldName', $referenceConfiguration); + if ( + (isset($processorConfiguration['references']) && $processorConfiguration['references']) + || (isset($processorConfiguration['references.']) && $processorConfiguration['references.']) + ) { + $referencesUidList = $cObj->stdWrapValue('references', $processorConfiguration); + $referencesUids = GeneralUtility::intExplode(',', $referencesUidList, true); + $fileCollector->addFileReferences($referencesUids); - // If no reference fieldName is set, there's nothing to do - if (!empty($relationField)) { - // Fetch the references of the default element - $relationTable = $cObj->stdWrapValue('table', $referenceConfiguration, $cObj->getCurrentTable()); - if (!empty($relationTable)) { - $fileCollector->addFilesFromRelation($relationTable, $relationField, $cObj->data); + if (!empty($processorConfiguration['references.'])) { + $referenceConfiguration = $processorConfiguration['references.']; + $relationField = $cObj->stdWrapValue('fieldName', $referenceConfiguration); + + // If no reference fieldName is set, there's nothing to do + if (!empty($relationField)) { + // Fetch the references of the default element + $relationTable = $cObj->stdWrapValue('table', $referenceConfiguration, $cObj->getCurrentTable()); + if (!empty($relationTable)) { + $fileCollector->addFilesFromRelation($relationTable, $relationField, $cObj->data); + } } } } -- GitLab