我已经更新到 CMS 7,现在我在使用 ObjectRenderer 时遇到了一些问题。
对于 TS CONTENT 和 RECORDS 对象,它不会正确呈现并且总是只返回一个空字符串。其他 TS 对象运行良好(文本、图像、链接)。
因此我在问这个问题,如果 cObjectRendererClass 的行为发生了变化?
我做了很多研究,其他人使用 cObjectRendererClass 的方式和我一样……这是我的 ViewHelper 代码片段,它呈现这些元素……
<?php
namespace TYPO3\Bh\ViewHelpers;
/**
* @package bh
* @author Michael Rainer
* @description Renders a Bakehouse-Content-Object
*
*/
class CObjectViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
* @param \TYPO3\Bh\Domain\Model\Content $content
*/
public function render(\TYPO3\Bh\Domain\Model\Content $content) {
$cObjRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer");
$conf = array( // config
'tables' => 'tt_content',
'source' => $content->getUid(),
'dontCheckPid' => 1
);
return $cObjRenderer->render( $cObjRenderer->getContentObject('RECORDS'), $conf );
}
}
?>
提前感谢您的有用回复:)。