TYPO3 CMS  TYPO3_7-6
OuterWrapContainer.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
23 
33 {
39  public function render()
40  {
41  $languageService = $this->getLanguageService();
42  $backendUser = $this->getBackendUserAuthentication();
43 
44  $table = $this->data['tableName'];
45  $row = $this->data['databaseRow'];
46 
47  $options = $this->data;
48  if (empty($this->data['fieldListToRender'])) {
49  $options['renderType'] = 'fullRecordContainer';
50  } else {
51  $options['renderType'] = 'listOfFieldsContainer';
52  }
53  $result = $this->nodeFactory->create($options)->render();
54 
55  $childHtml = $result['html'];
56 
57  $recordPath = '';
58  // @todo: what is this >= 0 check for? wsol cases?!
59  if ($this->data['effectivePid'] >= 0) {
60  $permissionsClause = $backendUser->getPagePermsClause(1);
61  $recordPath = BackendUtility::getRecordPath($this->data['effectivePid'], $permissionsClause, 15);
62  }
63 
64  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
65  $icon = '<span title="' . htmlspecialchars($recordPath) . '">' . $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>';
66 
67  // @todo: Could this be done in a more clever way? Does it work at all?
68  $tableTitle = $languageService->sL($this->data['processedTca']['ctrl']['title']);
69 
70  if ($this->data['command'] === 'new') {
71  $newOrUid = ' <span class="typo3-TCEforms-newToken">' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.new', true) . '</span>';
72 
73  // @todo: There is quite some stuff do to for WS overlays ...
74  $workspacedPageRecord = BackendUtility::getRecordWSOL('pages', $this->data['effectivePid'], 'title');
75  $pageTitle = BackendUtility::getRecordTitle('pages', $workspacedPageRecord, true, false);
76  if ($table === 'pages') {
77  $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewPage', true);
78  $pageTitle = sprintf($label, $tableTitle);
79  } else {
80  $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecord', true);
81  if ($this->data['effectivePid'] === 0) {
82  $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.createNewRecordRootLevel', true);
83  }
84  $pageTitle = sprintf($label, $tableTitle, $pageTitle);
85  }
86  } else {
87  $icon = BackendUtility::wrapClickMenuOnIcon($icon, $table, $row['uid'], 1, '', '+copy,info,edit,view');
88  $newOrUid = ' <span class="typo3-TCEforms-recUid">[' . htmlspecialchars($row['uid']) . ']</span>';
89 
90  // @todo: getRecordTitlePrep applies an htmlspecialchars here
91  $recordLabel = BackendUtility::getRecordTitlePrep($this->data['recordTitle']);
92  if ($table === 'pages') {
93  $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editPage', true);
94  $pageTitle = sprintf($label, $tableTitle, $recordLabel);
95  } else {
96  $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecord', true);
97  $workspacedPageRecord = BackendUtility::getRecordWSOL('pages', $row['pid'], 'uid,title');
98  $pageTitle = BackendUtility::getRecordTitle('pages', $workspacedPageRecord, true, false);
99  if (empty($recordLabel)) {
100  $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecordNoTitle', true);
101  }
102  if ($this->data['effectivePid'] === 0) {
103  $label = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.editRecordRootLevel', true);
104  }
105  if (!empty($recordLabel)) {
106  // Use record title and prepend an edit label.
107  $pageTitle = sprintf($label, $tableTitle, $recordLabel, $pageTitle);
108  } else {
109  // Leave out the record title since it is not set.
110  $pageTitle = sprintf($label, $tableTitle, $pageTitle);
111  }
112  }
113  }
114 
115  $html = [];
116  $html[] = '<h1>' . $pageTitle . '</h1>';
117  $html[] = '<div class="typo3-TCEforms">';
118  $html[] = $childHtml;
119  $html[] = '<div class="help-block text-right">';
120  $html[] = $icon . ' <strong>' . htmlspecialchars($tableTitle) . '</strong>' . ' ' . $newOrUid;
121  $html[] = '</div>';
122  $html[] = '</div>';
123 
124  $result['html'] = implode(LF, $html);
125  return $result;
126  }
127 
131  protected function getLanguageService()
132  {
133  return $GLOBALS['LANG'];
134  }
135 
139  protected function getBackendUserAuthentication()
140  {
141  return $GLOBALS['BE_USER'];
142  }
143 }
static getRecordTitle($table, $row, $prep=false, $forceResult=true)
static getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit=0)
static getRecordTitlePrep($title, $titleLength=0)
static wrapClickMenuOnIcon( $content, $table, $uid=0, $listFrame=true, $addParams='', $enDisItems='', $returnTagParameters=false)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static getRecordWSOL($table, $uid, $fields=' *', $where='', $useDeleteClause=true, $unsetMovePointers=false)