Get tt_content uid

I am developing an extension that allows administrators to store data in a database.

And I want each extension instance to have its own identifier in the database. Is there any way to get tt_content uid (which I think is the extension instance id) in the php extension.

+5
source share
4 answers

You get all the tt_content data in the array:

$this->cObj->data

t

$uidOfCE = $this->cObj->data['uid'];

If you are using Extbase, of course, you need to get the content object first, namely:

$this->contentObj = $this->configurationManager->getContentObject();
debug($this->contentObj->data, "current tt_content data");
+11
source

$ contentId is the typo3 backend content identifier

$content_rec = $GLOBALS["TYPO3_DB"]->exec_SELECTgetrows('header,bodytext','tt_content','uid='.$contentId);
$this->markerArray['###content###'] = $content_rec[0]['bodytext'];
0
source

( TYPO3 9.5.4)

HTML ,

$conf = [
    'tables' => 'tt_content',
    'source' => $uid, //uid of tt_content
    'dontCheckPid' => 1
];
$html = $GLOBALS['TSFE']->cObj->cObjGetSingle('RECORDS', $conf);
0

, uid , \TYPO3\CMS\Core\Utility\DebugUtility::debug($this->configurationManager->getContentObject()->data['uid'], 'parameter');

If it is not completed, debugging does not show uidbecause it configurationManagerand contentObjectuse contentObjectthe download.

It works and is tested from TYPO3 8.7

0
source

All Articles