Bug #90970
closedFilesProcessor ignores 'as' parameter
0%
Description
When using the FilesProcessor in TypoScript for getting an image object in the Frontend as Fluid variable, the 'as' variable name is not evaluated and replaced with Default Value
Prerequisites¶
Add an image to a page via Page Properties, Tab Resources, Media
Steps to reproduce the problem¶
Add FilesProcessor in TypoScript to FLUIDTEMPLATE. Add 'as' parameter to change the name of the Variable in the frontend.
Try to access it in fluid, e.g. via <f:debug>{_all}</f:debug> on the page.
Example:
page { 10 = FLUIDTEMPLATE 10 { dataProcessing { 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor 10.references { fieldName = media as = imageObject } } }
Actual results¶
The Image is available via Fluid Variable 'files'.
Expected results¶
Image should be available via Variable 'imageObject' (Name from TypoScript)
Suggested Fix¶
I figured out, that the Problem seems to be in the FilesProcessor.php itself (TYPO3\CMS\Frontend\DataProcessing\FilesProcessor).
Line 118:
$targetVariableName = $cObj->stdWrapValue('as', $processorConfiguration, 'files');
should be
$targetVariableName = $cObj->stdWrapValue('as', $referenceConfiguration, 'files');
$referenceConfiguration contains the 'fieldName' and the 'as' from TypoScript, $processorConfiguration holds the whole configuration. And because the Key 'as' cant be found in $processorConfiguration, the default value 'files' is used.
Updated by Christian Eßl over 4 years ago
You need to put your "as" outside of "references", like:
page {
10 = FLUIDTEMPLATE
10 {
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10.references {
fieldName = media
}
10.as = imageObject
}
}
The config inside "references" is just for reading in relation data.
Updated by Christian Eßl over 4 years ago
- Status changed from New to Needs Feedback
Updated by Justus Köster over 4 years ago
Well that makes sense of course... I thought I found a Documentation, where the as ist part of references. Thanks for helping me out
Updated by Georg Ringer over 4 years ago
- Status changed from Needs Feedback to Closed
closed as solved