Typo3更新到CMS 7 - > ObjectRenderer

时间:2016-03-18 12:36:46

标签: typo3 extbase typo3-7.x

我已更新到CMS 7,现在我遇到了ObjectRenderer的一些问题。
对于TS CONTENT和RECORDS对象,它无法正确呈现并始终只返回一个空字符串。其他TS对象运行良好(TEXT,IMAGE,LINK)。

因此,我问这个问题,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 );

    }

}

?>

提前感谢您的回复:)。

1 个答案:

答案 0 :(得分:0)

我明白了!我终于明白了!说实话,我旁边的那个人发现了它。

您必须在Root-Template中包含“CSS样式内容”。 你可能会问为什么要这样做?我不能给你答案。我不知道,可能没有人知道。只是做它,它就像一个魅力。

幸运的我。我不必回到Joomla。

相关问题