I need to render with my extension a specific content from tt_content.
How can I do this?
\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer ?
I need to render with my extension a specific content from tt_content.
How can I do this?
\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer ?
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);
You can use the Typoscript CONTENT object and pass it to a fluid ViewHelper:
lib.myContent = CONTENT
lib.myContent {
table = tt_content
select {
pidInList = yourPid
where = uid=yourContentElementID
}
}
In your extension using Fluid:
<f:cObject typoscriptObjectPath="lib.myContent" />
You can also pass values through the vie helper, see here
You can do it from the controller too. If I understood your question, you may want to try this
$cObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
Following script will be use PI base extension.
$uid = $this->cObj->data['uid'];
if ($this->cObj->data['_LOCALIZED_UID']) {
$uid = $this->cObj->data['_LOCALIZED_UID'];
}
Following script will be use in EXT BASE extension.
$this->contentObj = $this->configurationManager->getContentObject();
$uid = $this->contentObj->data['uid'];
For more information about TYPO3 stuff you may visit my blog
https://jainishsenjaliya.wordpress.com/2014/08/21/how-to-get-current-tt_content-uid-in-pi-base-and-extbase-extension/