public function render()
{
$contentUid = intval($this->arguments['contentUid']);
if (0 === $contentUid) {
$cObj = $this->configurationManager->getContentObject();
$record = $cObj->data;
}
$field = $this->arguments['field'];
if (false === isset($record) && 0 !== $contentUid) {
if (null !== $field && true === isset($GLOBALS['TCA']['tt_content']['columns'][$field])) {
$selectFields = $field;
} else {
$selectFields = '*';
}
$record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow($selectFields, 'tt_content', sprintf('uid=%d', $contentUid));
// Add the page overlay
$languageUid = intval($GLOBALS['TSFE']->sys_language_uid);
if (0 !== $languageUid && $GLOBALS['TSFE']->sys_language_contentOL) {
$record = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_content', $record, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
}
}
if (false === $record && false === isset($record)) {
throw new \Exception(sprintf('Either record with uid %d or field %s do not exist.', $contentUid, $selectFields), 1358679983);
}
// Check if single field or whole record should be returned
$content = null;
if (null === $field) {
$content = $record;
} elseif (true === isset($record[$field])) {
$content = $record[$field];
}
return $this->renderChildrenWithVariableOrReturnInput($content);
}