Issue Bug Closed

#90970FilesProcessor ignores 'as' parameter

Justus Köster 04/07/20, 12:45 updated 04/08/20, 19:09

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.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.