[SOLVED] Using FilesProcessor to pass page media to template throws exception when page has hidden images

Hello!

I’m using TYPO3 13.4.27, the plugin I’m describing worked without issue in TYPO3 12.4.44. I want this plugin to write the non-hidden file references attached to the current page into the pageMedia variable to then do stuff with in the fluid template.

I’m trying to update a TYPO3 installation from v12 to v13. The installation has a plugin on most pages, which will pass the first non-hidden image of the page to a fluid template and render it at the top of the page as a stage element. We use the typoscript type FLUIDTEMPLATE for that and provide the image via the FilesProcessor with the following configuration:

fce.basic = FLUIDTEMPLATE  
fce.basic.dataProcessing.10 = flex-form

fce.standardElement < fce.basic
fce.standardElement {  
  dataProcessing {  
    20 = files  
    20 {  
      as = pageMedia  
	  references.data = levelmedia: -1 
    }  
  }  
  
  file = [imagine a real path here].html  
  partialRootPath = [imagine a real path here]
}


from what I gather from the documentation of the FilesProcessor this will search the current page for file references and pass them to the frontend in the pageMedia variable which can then be used by fluid.

However, this throws an exception in the FilesProcessor on line 67 - a referencesUidList is generated via ContentObjectRenderer::stdWrapValue which contains both the hidden and visible file references. This then causes the FileCollector to (understandably) fail.

I’ve tried modifying the configuration by specifying fieldNameand table instead of data resulting in the following configuration:

fce.basic = FLUIDTEMPLATE  
fce.basic.dataProcessing.10 = flex-form

fce.standardElement < fce.basic
fce.standardElement {  
  dataProcessing {  
    20 = files  
    20 {  
      as = pageMedia  
	  references {
		table = pages
		fieldName = media
	  }
    }  
  }  
  
  file = [imagine a real path here].html  
  partialRootPath = [imagine a real path here]
}


this then leads to the uid list from stdwrap being empty. I’m a little clueless at this point, any help would be greatly appreciated!

As a workaround, I’ve implemented a custom data processor that fetches the sys file references using an extbase repository (the plugin loads extbase either way). I’m a bit dissatisfied because this seems like a straightforward use-case that should be solvable using configuration only, but at least the frontend looks correct now (and doesn’t return 503 errors anymore). I’d still like to know if there would be a better way to solve this

Hi @leowonie!

Welcome to talk.typo3.org!

levelmedia not respecting hidden sounds like a bug to me. I think it could even be a reincarnation of this bug that was fixed 12 years ago:

I recommend that you submit a bug report and mention both this thread and the issue I linked above. Please reply to this thread with a link to your bug report as well, so others visiting this thread can check the status of your report.

Hi Mathias,

thank you for the warm welcome and your quick response! :slight_smile: I’ve created the bug report as you’ve recommended:

1 Like