我已经用 Viewhelper 解决了这个问题:
class DcevalViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
* @param ArminVieweg\Dce\Domain\Model\Dce object
*
* @return array
*
*/
public function render($dce) {
$contentObject = $dce->getContentObject();
$temp = GeneralUtility::xml2array($contentObject['pi_flexform']);
$temp = $temp['data']['sheet.tabGeneral']['lDEF'];
foreach($temp as $key=>$val) {
preg_replace( "/\r|\n/", "", $val['vDEF'] );
$dcedata[substr($key,9)]=$val['vDEF'];
}
$dcedata['uid']=$contentObject['uid'];
return $dcedata;
}
}
并且在 Containertemplate 中(不需要 Child 模板)
{namespace dce=ArminVieweg\Dce\ViewHelpers}
{namespace tom=Mediagmbh\Tomediavh\ViewHelpers}
<f:layout name="DefaultContainer" />
<f:section name="main">
<div id="foo">
<ul>
<f:for each="{dces}" as="dce">
<f:alias map="{field:'{tom:Dceval(dce:dce)}'}">
<li>{field.header}</li>
</f:alias>
</f:for>
</ul>
</div
<div id="bar">
<f:for each="{dces}" as="dce">
<f:alias map="{field:'{tom:Dceval(dce:dce)}'}">
<div><f:format.raw>{field.text}</f:format.raw></div>
</f:alias>
</f:for>
</div>
</div>
</f:section>