databasepluginstypo3frontendtypo3-6.1.x

How to render a Content Object from tt_content in my extension with PHP in Typo3 6.1.5


I need to render with my extension a specific content from tt_content.

How can I do this?

\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer ?


Solution

  • In Extbase extensions $this->cObj is no more available in the current scope, so you need to get it first before you can use:

    $cObj = $this->configurationManager->getContentObject();
    
    $ttContentConfig = array(
        'tables'       => 'tt_content',
        'source'       => 123,
        'dontCheckPid' => 1
    );
    
    $content .= $cObj->RECORDS($ttContentConfig);