我创建了一个带有“媒体”字段的自定义内容元素。
这是我的数据处理器类:
class CustomCeProcessor implements DataProcessorInterface
{
/**
* Process data for the content element "My new content element"
*
* @param ContentObjectRenderer $cObj The data of the content element or page
* @param array $contentObjectConfiguration The configuration of Content Object
* @param array $processorConfiguration The configuration of this processor
* @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
* @return array the processed data as key/value store
*/
public function process(
ContentObjectRenderer $cObj,
array $contentObjectConfiguration,
array $processorConfiguration,
array $processedData
)
{
$processedData['foo'] = 'This variable will be passed to Fluid';
return $processedData;
}
}
$ processedData包含期望“媒体字段”为空数组的每个字段的值。
以下是我的TCA的样子:
$GLOBALS['TCA']['tt_content']['types']['custom_ce'] = [
'showitem' => '
--palette--;' . $frontendLanguageFilePrefix . 'palette.general;general,
--linebreak--, header;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_formlabel,
--linebreak--, date;Datum,
--linebreak--, media;Media,
--linebreak--, bodytext;txt,
'
];
如何访问DataProcess中的媒体文件以将其传递给流体?
答案 0 :(得分:1)
TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
可以做到这一点。编写自己的DataProcessor不是必需的。
激活调试视图帮助时,您的文件应显示为my_pdf
。
请使用Fluid debug viewhelper验证您的文件是否可见。