getLanguageService();
$backendUser = $this->getBackendUserAuthentication();
$table = $this->data['tableName'];
$row = $this->data['databaseRow'];
$options = $this->data;
if (empty($this->data['fieldListToRender'])) {
$options['renderType'] = 'fullRecordContainer';
} else {
$options['renderType'] = 'listOfFieldsContainer';
}
$result = $this->nodeFactory->create($options)->render();
$childHtml = $result['html'];
$recordPath = '';
// @todo: what is this >= 0 check for? wsol cases?!
if ($this->data['effectivePid'] >= 0) {
$permissionsClause = $backendUser->getPagePermsClause(Permission::PAGE_SHOW);
$recordPath = BackendUtility::getRecordPath($this->data['effectivePid'], $permissionsClause, 15);
}
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icon = '' . $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '';
// @todo: Could this be done in a more clever way? Does it work at all?
$tableTitle = $languageService->sL($this->data['processedTca']['ctrl']['title']);
if ($this->data['command'] === 'new') {
$newOrUid = ' ' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.new')) . '';
// @todo: There is quite some stuff do to for WS overlays ...
$workspacedPageRecord = BackendUtility::getRecordWSOL('pages', $this->data['effectivePid'], 'title');
$pageTitle = BackendUtility::getRecordTitle('pages', $workspacedPageRecord, true, false);
if ($table === 'pages') {
$label = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.createNewPage'));
$pageTitle = sprintf($label, $tableTitle);
} else {
$label = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.createNewRecord'));
if ($this->data['effectivePid'] === 0) {
$label = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.createNewRecordRootLevel'));
}
$pageTitle = sprintf($label, $tableTitle, $pageTitle);
}
} else {
$icon = BackendUtility::wrapClickMenuOnIcon($icon, $table, $row['uid']);
$newOrUid = ' [' . htmlspecialchars($row['uid']) . ']';
// @todo: getRecordTitlePrep applies an htmlspecialchars here
$recordLabel = BackendUtility::getRecordTitlePrep($this->data['recordTitle']);
if ($table === 'pages') {
$label = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.editPage'));
$pageTitle = sprintf($label, $tableTitle, $recordLabel);
} else {
$label = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.editRecord'));
$workspacedPageRecord = BackendUtility::getRecordWSOL('pages', $row['pid'], 'uid,title');
$pageTitle = BackendUtility::getRecordTitle('pages', $workspacedPageRecord, true, false);
if (empty($recordLabel)) {
$label = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.editRecordNoTitle'));
}
if ($this->data['effectivePid'] === 0) {
$label = htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.editRecordRootLevel'));
}
if (!empty($recordLabel)) {
// Use record title and prepend an edit label.
$pageTitle = sprintf($label, $tableTitle, $recordLabel, $pageTitle);
} else {
// Leave out the record title since it is not set.
$pageTitle = sprintf($label, $tableTitle, $pageTitle);
}
}
}
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
'EXT:backend/Resources/Private/Templates/OuterWrapContainer.html'
));
$descriptionColumn = !empty($this->data['processedTca']['ctrl']['descriptionColumn'])
? $this->data['processedTca']['ctrl']['descriptionColumn'] : null;
if ($descriptionColumn !== null) {
$title = $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.recordInformation');
$content = $this->data['databaseRow'][$descriptionColumn];
$view->assignMultiple([
'infoBoxMessageTitle' => $title,
'infoBoxMessage' => $content
]);
}
$fieldInformationResult = $this->renderFieldInformation();
$fieldInformationHtml = $fieldInformationResult['html'];
$result = $this->mergeChildReturnIntoExistingResult($result, $fieldInformationResult, false);
$fieldWizardResult = $this->renderFieldWizard();
$fieldWizardHtml = $fieldWizardResult['html'];
$result = $this->mergeChildReturnIntoExistingResult($result, $fieldWizardResult, false);
$view->assignMultiple([
'pageTitle' => $pageTitle,
'fieldInformationHtml' => $fieldInformationHtml,
'fieldWizardHtml' => $fieldWizardHtml,
'childHtml' => $childHtml,
'icon' => $icon,
'tableTitle' => $tableTitle,
'newOrUid' => $newOrUid
]);
$result['html'] = $view->render();
return $result;
}
/**
* @return LanguageService
*/
protected function getLanguageService()
{
return $GLOBALS['LANG'];
}
/**
* @return BackendUserAuthentication
*/
protected function getBackendUserAuthentication()
{
return $GLOBALS['BE_USER'];
}
}