Commit 98f1f28f authored by Stefan Froemken's avatar Stefan Froemken Committed by Susanne Moog
Browse files

[FEATURE] Add stdWrap properties to references in FilesProcessor

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: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarJörg Bösche <typo3@joergboesche.de>
Tested-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Tested-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
Reviewed-by: default avatarJörg Bösche <typo3@joergboesche.de>
Reviewed-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Reviewed-by: default avatarFelix P. <f.pachowsky@neusta.de>
Reviewed-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
parent f6ec9646
.. 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
......@@ -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);
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment