Task #104502
closedRecordTransformationProcessor is incompatible with f:cObject
100%
Description
Comming from the surfcamp, I've tried to setup my content rendering without fluid_styled_content (not installed in project). And therefore came up with the following typoscript configuration using RecordTransformationProcessor to fetch the content elements:
# Default configuration for content elements which are using FLUIDTEMPLATE directly lib.contentElement > lib.contentElement = FLUIDTEMPLATE lib.contentElement { templateName = Default templateRootPaths { 0 = EXT:site-distribution/Resources/Private/Templates/Content/ 10 = {$content.templates.templateRootPath} } partialRootPaths { 0 = EXT:site-distribution/Resources/Private/Templates/Content/Partials/ 10 = {$content.templates.partialRootPath} } layoutRootPaths { 0 = EXT:site-distribution/Resources/Private/Templates/Content/Layouts/ 10 = {$content.templates.layoutRootPath} } dataProcessing { 5 = record-transformation 5 { table = tt_content as = data } } }
With this configuration "data" is now of type TYPO3\CMS\Core\Domain\Record instead array (compared to the fluid_styled_content way):
This results in forms not being rendered as the pi_flexform values are not recogniced in the f:cObject. (See second debug which is from "Render.html" of the Forms extension).
<f:cObject typoscriptObjectPath="tt_content.{data.CType}.20" data="{data}" table="tt_content" />
For Objects the f:cObject Viewhelper calls ObjectAccess::getGettableProperties() which doesn't resolve the pi_flexform field:
if (is_object($data)) {
$data = ObjectAccess::getGettableProperties($data);
} elseif (is_string($data) || is_numeric($data)) {
$currentValue = (string)$data;
$data = [$data];
}
https://github.com/TYPO3/typo3/blob/ca8f1f9f9240e80a222e99b7b404226f4caddf90/typo3/sysext/fluid/Classes/ViewHelpers/CObjectViewHelper.php#L132-L133
Possible solutions:
1. Convert Record to array for f:cObject call
2. Check for type RecordInterface and use ->toArray() in f:cObject Viewhelper
3. ...
Files