Project

General

Profile

Actions

Bug #90970

closed

FilesProcessor ignores 'as' parameter

Added by Justus Köster almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
Start date:
2020-04-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

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.

Actions #1

Updated by Christian Eßl almost 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.

Actions #2

Updated by Christian Eßl almost 4 years ago

  • Status changed from New to Needs Feedback
Actions #3

Updated by Justus Köster almost 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

Actions #4

Updated by Georg Ringer almost 4 years ago

  • Status changed from Needs Feedback to Closed

closed as solved

Actions

Also available in: Atom PDF