[BUGFIX] Changes indentation in new page wizard
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Tree / View / PagePositionMap.php
1 <?php
2 namespace TYPO3\CMS\Backend\Tree\View;
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
17 use TYPO3\CMS\Backend\Utility\BackendUtility;
18 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
19 use TYPO3\CMS\Core\Database\ConnectionPool;
20 use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
21 use TYPO3\CMS\Core\Database\Query\Restriction\EndTimeRestriction;
22 use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
23 use TYPO3\CMS\Core\Database\Query\Restriction\StartTimeRestriction;
24 use TYPO3\CMS\Core\Imaging\Icon;
25 use TYPO3\CMS\Core\Imaging\IconFactory;
26 use TYPO3\CMS\Core\Localization\LanguageService;
27 use TYPO3\CMS\Core\Utility\GeneralUtility;
28
29 /**
30 * Position map class - generating a page tree / content element list which links for inserting (copy/move) of records.
31 * Used for pages / tt_content element wizards of various kinds.
32 */
33 class PagePositionMap
34 {
35 // EXTERNAL, static:
36 /**
37 * @var string
38 */
39 public $moveOrCopy = 'move';
40
41 /**
42 * @var int
43 */
44 public $dontPrintPageInsertIcons = 0;
45
46 // How deep the position page tree will go.
47 /**
48 * @var int
49 */
50 public $depth = 2;
51
52 // Can be set to the sys_language uid to select content elements for.
53 /**
54 * @var string
55 */
56 public $cur_sys_language;
57
58 // INTERNAL, dynamic:
59 // Request uri
60 /**
61 * @var string
62 */
63 public $R_URI = '';
64
65 // Element id.
66 /**
67 * @var string
68 */
69 public $elUid = '';
70
71 // tt_content element uid to move.
72 /**
73 * @var string
74 */
75 public $moveUid = '';
76
77 // Caching arrays:
78 /**
79 * @var array
80 */
81 public $getModConfigCache = [];
82
83 /**
84 * @var array
85 */
86 public $checkNewPageCache = [];
87
88 // Label keys:
89 /**
90 * @var string
91 */
92 public $l_insertNewPageHere = 'insertNewPageHere';
93
94 /**
95 * @var string
96 */
97 public $l_insertNewRecordHere = 'insertNewRecordHere';
98
99 /**
100 * @var string
101 */
102 public $modConfigStr = 'mod.web_list.newPageWiz';
103
104 /**
105 * Page tree implementation class name
106 *
107 * @var string
108 */
109 protected $pageTreeClassName = ElementBrowserPageTreeView::class;
110
111 /**
112 * @var IconFactory
113 */
114 protected $iconFactory;
115
116 /**
117 * Constructor allowing to set pageTreeImplementation
118 *
119 * @param string $pageTreeClassName
120 */
121 public function __construct($pageTreeClassName = null)
122 {
123 if ($pageTreeClassName !== null) {
124 $this->pageTreeClassName = $pageTreeClassName;
125 }
126 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
127 }
128
129 /*************************************
130 *
131 * Page position map:
132 *
133 **************************************/
134 /**
135 * Creates a "position tree" based on the page tree.
136 *
137 * @param int $id Current page id
138 * @param array $pageinfo Current page record.
139 * @param string $perms_clause Page selection permission clause.
140 * @param string $R_URI Current REQUEST_URI
141 * @return string HTML code for the tree.
142 */
143 public function positionTree($id, $pageinfo, $perms_clause, $R_URI)
144 {
145 // Make page tree object:
146 /** @var \TYPO3\CMS\Backend\Tree\View\PageTreeView $pageTree */
147 $pageTree = GeneralUtility::makeInstance($this->pageTreeClassName);
148 $pageTree->init(' AND ' . $perms_clause);
149 $pageTree->addField('pid');
150 // Initialize variables:
151 $this->R_URI = $R_URI;
152 $this->elUid = $id;
153 // Create page tree, in $this->depth levels.
154 $pageTree->getTree($pageinfo['pid'], $this->depth);
155 // Initialize variables:
156 $saveLatestUid = [];
157 $latestInvDepth = $this->depth;
158 // Traverse the tree:
159 $lines = [];
160 foreach ($pageTree->tree as $cc => $dat) {
161 if ($latestInvDepth > $dat['invertedDepth']) {
162 $margin = 'style="margin-left: ' . ($dat['invertedDepth'] * 16 + 9) . 'px;"';
163 $lines[] = '<ul class="list-tree" ' . $margin . '>';
164 }
165 // Make link + parameters.
166 $latestInvDepth = $dat['invertedDepth'];
167 $saveLatestUid[$latestInvDepth] = $dat;
168 if (isset($pageTree->tree[$cc - 1])) {
169 $prev_dat = $pageTree->tree[$cc - 1];
170 // If current page, subpage?
171 if ($prev_dat['row']['uid'] == $id) {
172 // 1) It must be allowed to create a new page and 2) If there are subpages there is no need to render a subpage icon here - it'll be done over the subpages...
173 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id) && !($prev_dat['invertedDepth'] > $pageTree->tree[$cc]['invertedDepth'])) {
174 end($lines);
175 $margin = 'style="margin-left: ' . (($dat['invertedDepth'] - 1) * 16 + 9) . 'px;"';
176 $lines[] = '<ul class="list-tree" ' . $margin . '><li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($id, $id)) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span></li></ul>';
177 }
178 }
179 // If going down
180 if ($prev_dat['invertedDepth'] > $pageTree->tree[$cc]['invertedDepth']) {
181 $prevPid = $pageTree->tree[$cc]['row']['pid'];
182 } elseif ($prev_dat['invertedDepth'] < $pageTree->tree[$cc]['invertedDepth']) {
183 // If going up
184 // First of all the previous level should have an icon:
185 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($prev_dat['row']['pid'])) {
186 $prevPid = -$prev_dat['row']['uid'];
187 end($lines);
188 $lines[] = '<li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $prev_dat['row']['pid'])) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span></li>';
189 }
190 // Then set the current prevPid
191 $prevPid = -$prev_dat['row']['pid'];
192 if ($prevPid !== $dat['row']['pid']) {
193 $lines[] = '</ul>';
194 }
195 } else {
196 // In on the same level
197 $prevPid = -$prev_dat['row']['uid'];
198 }
199 } else {
200 // First in the tree
201 $prevPid = $dat['row']['pid'];
202 }
203 // print arrow on the same level
204 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) {
205 $lines[] = '<span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $dat['row']['pid'])) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span>';
206 }
207 // The line with the icon and title:
208 $toolTip = BackendUtility::getRecordToolTip($dat['row'], 'pages');
209 $icon = '<span ' . $toolTip . '>' . $this->iconFactory->getIconForRecord('pages', $dat['row'], Icon::SIZE_SMALL)->render() . '</span>';
210
211 $lines[] = '<span class="text-nowrap">' . $icon . $this->linkPageTitle($this->boldTitle(htmlspecialchars(GeneralUtility::fixed_lgd_cs($dat['row']['title'], $this->getBackendUser()->uc['titleLen'])), $dat, $id), $dat['row']) . '</span>';
212 }
213 // If the current page was the last in the tree:
214 $prev_dat = end($pageTree->tree);
215 if ($prev_dat['row']['uid'] == $id) {
216 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id)) {
217 $lines[] = '<ul class="list-tree" style="margin-left: 25px"><li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($id, $id)) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span></li></ul>';
218 }
219 }
220 for ($a = $latestInvDepth; $a <= $this->depth; $a++) {
221 $dat = $saveLatestUid[$a];
222 $prevPid = -$dat['row']['uid'];
223 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) {
224 if ($latestInvDepth < $dat['invertedDepth']) {
225 $lines[] = '</ul>';
226 }
227 $lines[] = '<span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $dat['row']['pid'])) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span>';
228 }
229 }
230
231 $code = '<ul class="list-tree">';
232
233 foreach ($lines as $line) {
234 if ((substr($line, 0, 3) === '<ul') || (substr($line, 0, 4) === '</ul')) {
235 $code .= $line;
236 } else {
237 $code .= '<li>' . $line . '</li>';
238 }
239 }
240
241 $code .= '</ul>';
242 return $code;
243 }
244
245 /**
246 * Wrap $t_code in bold IF the $dat uid matches $id
247 *
248 * @param string $t_code Title string
249 * @param array $dat Information array with record array inside.
250 * @param int $id The current id.
251 * @return string The title string.
252 */
253 public function boldTitle($t_code, $dat, $id)
254 {
255 if ($dat['row']['uid'] == $id) {
256 $t_code = '<strong>' . $t_code . '</strong>';
257 }
258 return $t_code;
259 }
260
261 /**
262 * Creates the onclick event for the insert-icons.
263 *
264 * TSconfig mod.newPageWizard.override may contain an alternative module / route which can be
265 * used instead of the normal create new page wizard.
266 *
267 * @param int $pid The pid.
268 * @param int $newPagePID New page id.
269 * @return string Onclick attribute content
270 */
271 public function onClickEvent($pid, $newPagePID)
272 {
273 $TSconfig = BackendUtility::getModTSconfig($newPagePID, 'mod.newPageWizard');
274 $TSconfig = $TSconfig['properties'];
275 if (isset($TSconfig['override']) && !empty($TSconfig['override'])) {
276 $url = BackendUtility::getModuleUrl($TSconfig['override'], [
277 'positionPid' => $pid,
278 'newPageId' => $newPagePID,
279 'cmd' => 'crPage',
280 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]
281 );
282 return 'window.location.href=' . GeneralUtility::quoteJSvalue($url) . ';';
283 }
284 $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1';
285 return BackendUtility::editOnClick($params, '', $this->R_URI);
286 }
287
288 /**
289 * Get label, htmlspecialchars()'ed
290 *
291 * @return string The localized label for "insert new page here
292 */
293 public function insertlabel()
294 {
295 return htmlspecialchars($this->getLanguageService()->getLL($this->l_insertNewPageHere));
296 }
297
298 /**
299 * Wrapping page title.
300 *
301 * @param string $str Page title.
302 * @param array $rec Page record (?)
303 * @return string Wrapped title.
304 */
305 public function linkPageTitle($str, $rec)
306 {
307 return $str;
308 }
309
310 /**
311 * Checks if the user has permission to created pages inside of the $pid page.
312 * Uses caching so only one regular lookup is made - hence you can call the function multiple times without worrying about performance.
313 *
314 * @param int $pid Page id for which to test.
315 * @return bool
316 */
317 public function checkNewPageInPid($pid)
318 {
319 if (!isset($this->checkNewPageCache[$pid])) {
320 $pidInfo = BackendUtility::getRecord('pages', $pid);
321 $this->checkNewPageCache[$pid] = $this->getBackendUser()->isAdmin() || $this->getBackendUser()->doesUserHaveAccess($pidInfo, 8);
322 }
323 return $this->checkNewPageCache[$pid];
324 }
325
326 /**
327 * Returns module configuration for a pid.
328 *
329 * @param int $pid Page id for which to get the module configuration.
330 * @return array The properties of the module configuration for the page id.
331 * @see onClickEvent()
332 */
333 public function getModConfig($pid)
334 {
335 if (!isset($this->getModConfigCache[$pid])) {
336 // Acquiring TSconfig for this PID:
337 $this->getModConfigCache[$pid] = BackendUtility::getModTSconfig($pid, $this->modConfigStr);
338 }
339 return $this->getModConfigCache[$pid]['properties'];
340 }
341
342 /*************************************
343 *
344 * Content element positioning:
345 *
346 **************************************/
347 /**
348 * Creates HTML for inserting/moving content elements.
349 *
350 * @param int $pid page id onto which to insert content element.
351 * @param int $moveUid Move-uid (tt_content element uid?)
352 * @param string $colPosList List of columns to show
353 * @param bool $showHidden If not set, then hidden/starttime/endtime records are filtered out.
354 * @param string $R_URI Request URI
355 * @return string HTML
356 */
357 public function printContentElementColumns($pid, $moveUid, $colPosList, $showHidden, $R_URI)
358 {
359 $this->R_URI = $R_URI;
360 $this->moveUid = $moveUid;
361 $colPosArray = GeneralUtility::trimExplode(',', $colPosList, true);
362 $lines = [];
363 foreach ($colPosArray as $kk => $vv) {
364 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
365 $queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
366 if ($showHidden) {
367 $queryBuilder->getRestrictions()
368 ->removeByType(HiddenRestriction::class)
369 ->removeByType(StartTimeRestriction::class)
370 ->removeByType(EndTimeRestriction::class);
371 }
372 $queryBuilder
373 ->select('*')
374 ->from('tt_content')
375 ->where(
376 $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)),
377 $queryBuilder->expr()->eq('colPos', $queryBuilder->createNamedParameter($vv, \PDO::PARAM_INT))
378 )
379 ->orderBy('sorting');
380
381 if ((string)$this->cur_sys_language !== '') {
382 $queryBuilder->andWhere(
383 $queryBuilder->expr()->eq(
384 'sys_language_uid',
385 $queryBuilder->createNamedParameter($this->cur_sys_language, \PDO::PARAM_INT)
386 )
387 );
388 }
389
390 $res = $queryBuilder->execute();
391 $lines[$vv] = [];
392 $lines[$vv][] = $this->insertPositionIcon('', $vv, $kk, $moveUid, $pid);
393
394 while ($row = $res->fetch()) {
395 BackendUtility::workspaceOL('tt_content', $row);
396 if (is_array($row)) {
397 $lines[$vv][] = $this->wrapRecordHeader($this->getRecordHeader($row), $row);
398 $lines[$vv][] = $this->insertPositionIcon($row, $vv, $kk, $moveUid, $pid);
399 }
400 }
401 }
402 return $this->printRecordMap($lines, $colPosArray, $pid);
403 }
404
405 /**
406 * Creates the table with the content columns
407 *
408 * @param array $lines Array with arrays of lines for each column
409 * @param array $colPosArray Column position array
410 * @param int $pid The id of the page
411 * @return string HTML
412 */
413 public function printRecordMap($lines, $colPosArray, $pid = 0)
414 {
415 $count = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(count($colPosArray), 1);
416 $backendLayout = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getSelectedBackendLayout', $pid, $this);
417 if (isset($backendLayout['__config']['backend_layout.'])) {
418 $this->getLanguageService()->includeLLFile('EXT:backend/Resources/Private/Language/locallang_layout.xlf');
419 $table = '<div class="table-fit"><table class="table table-condensed table-bordered table-vertical-top">';
420 $colCount = (int)$backendLayout['__config']['backend_layout.']['colCount'];
421 $rowCount = (int)$backendLayout['__config']['backend_layout.']['rowCount'];
422 $table .= '<colgroup>';
423 for ($i = 0; $i < $colCount; $i++) {
424 $table .= '<col style="width:' . 100 / $colCount . '%"></col>';
425 }
426 $table .= '</colgroup>';
427 $table .= '<tbody>';
428 $tcaItems = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $pid, $this);
429 // Cycle through rows
430 for ($row = 1; $row <= $rowCount; $row++) {
431 $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
432 if (!isset($rowConfig)) {
433 continue;
434 }
435 $table .= '<tr>';
436 for ($col = 1; $col <= $colCount; $col++) {
437 $columnConfig = $rowConfig['columns.'][$col . '.'];
438 if (!isset($columnConfig)) {
439 continue;
440 }
441 // Which tt_content colPos should be displayed inside this cell
442 $columnKey = (int)$columnConfig['colPos'];
443 $head = '';
444 foreach ($tcaItems as $item) {
445 if ($item[1] == $columnKey) {
446 $head = htmlspecialchars($this->getLanguageService()->sL($item[0]));
447 }
448 }
449 // Render the grid cell
450 $table .= '<td'
451 . (isset($columnConfig['colspan']) ? ' colspan="' . $columnConfig['colspan'] . '"' : '')
452 . (isset($columnConfig['rowspan']) ? ' rowspan="' . $columnConfig['rowspan'] . '"' : '')
453 . ' class="col-nowrap col-min'
454 . (!isset($columnConfig['colPos']) ? ' warning' : '')
455 . (isset($columnConfig['colPos']) && !$head ? ' danger' : '') . '">';
456 // Render header
457 $table .= '<p>';
458 if (isset($columnConfig['colPos']) && $head) {
459 $table .= '<strong>' . $this->wrapColumnHeader($head, '', '') . '</strong>';
460 } elseif ($columnConfig['colPos']) {
461 $table .= '<em>' . $this->wrapColumnHeader($this->getLanguageService()->getLL('noAccess'), '', '') . '</em>';
462 } else {
463 $table .= '<em>' . $this->wrapColumnHeader(($this->getLanguageService()->sL($columnConfig['name']) ?: '') . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')', '', '') . '</em>';
464 }
465 $table .= '</p>';
466 // Render lines
467 if (isset($columnConfig['colPos']) && $head && !empty($lines[$columnKey])) {
468 $table .= '<ul class="list-unstyled">';
469 foreach ($lines[$columnKey] as $line) {
470 $table .= '<li>' . $line . '</li>';
471 }
472 $table .= '</ul>';
473 }
474 $table .= '</td>';
475 }
476 $table .= '</tr>';
477 }
478 $table .= '</tbody>';
479 $table .= '</table></div>';
480 } else {
481 // Traverse the columns here:
482 $row = '';
483 foreach ($colPosArray as $kk => $vv) {
484 $row .= '<td class="col-nowrap col-min" width="' . round(100 / $count) . '%">';
485 $row .= '<p><strong>' . $this->wrapColumnHeader(htmlspecialchars($this->getLanguageService()->sL(BackendUtility::getLabelFromItemlist('tt_content', 'colPos', $vv))), $vv) . '</strong></p>';
486 if (!empty($lines[$vv])) {
487 $row .= '<ul class="list-unstyled">';
488 foreach ($lines[$vv] as $line) {
489 $row .= '<li>' . $line . '</li>';
490 }
491 $row .= '</ul>';
492 }
493 $row .= '</td>';
494 }
495 $table = '
496
497 <!--
498 Map of records in columns:
499 -->
500 <div class="table-fit">
501 <table class="table table-condensed table-bordered table-vertical-top">
502 <tr>' . $row . '</tr>
503 </table>
504 </div>
505
506 ';
507 }
508 return $table;
509 }
510
511 /**
512 * Wrapping the column header
513 *
514 * @param string $str Header value
515 * @param string $vv Column info.
516 * @return string
517 * @see printRecordMap()
518 */
519 public function wrapColumnHeader($str, $vv)
520 {
521 return $str;
522 }
523
524 /**
525 * Creates a linked position icon.
526 *
527 * @param mixed $row Element row. If this is an array the link will cause an insert after this content element, otherwise
528 * the link will insert at the first position in the column
529 * @param string $vv Column position value.
530 * @param int $kk Column key.
531 * @param int $moveUid Move uid
532 * @param int $pid PID value.
533 * @return string
534 */
535 public function insertPositionIcon($row, $vv, $kk, $moveUid, $pid)
536 {
537 if (is_array($row) && !empty($row['uid'])) {
538 // Use record uid for the hash when inserting after this content element
539 $uid = $row['uid'];
540 } else {
541 // No uid means insert at first position in the column
542 $uid = '';
543 }
544 $cc = hexdec(substr(md5($uid . '-' . $vv . '-' . $kk), 0, 4));
545 return '<a href="#" onclick="' . htmlspecialchars($this->onClickInsertRecord($row, $vv, $moveUid, $pid, $this->cur_sys_language)) . '">' . '<i class="t3-icon fa fa-long-arrow-left" name="mImgEnd' . $cc . '" title="' . htmlspecialchars($this->getLanguageService()->getLL($this->l_insertNewRecordHere)) . '"></i></a>';
546 }
547
548 /**
549 * Create on-click event value.
550 *
551 * @param mixed $row The record. If this is not an array with the record data the insert will be for the first position
552 * in the column
553 * @param string $vv Column position value.
554 * @param int $moveUid Move uid
555 * @param int $pid PID value.
556 * @param int $sys_lang System language (not used currently)
557 * @return string
558 */
559 public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0)
560 {
561 $table = 'tt_content';
562 if (is_array($row)) {
563 $location = BackendUtility::getModuleUrl('tce_db') . '&cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=-' . $row['uid'] . '&prErr=1&uPT=1';
564 } else {
565 $location = BackendUtility::getModuleUrl('tce_db') . '&cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&data[' . $table . '][' . $moveUid . '][colPos]=' . $vv . '&prErr=1';
566 }
567 $location .= '&redirect=' . rawurlencode($this->R_URI);
568 // returns to prev. page
569 return 'window.location.href=' . GeneralUtility::quoteJSvalue($location) . ';return false;';
570 }
571
572 /**
573 * Wrapping the record header (from getRecordHeader())
574 *
575 * @param string $str HTML content
576 * @param string $row Record array.
577 * @return string HTML content
578 */
579 public function wrapRecordHeader($str, $row)
580 {
581 return $str;
582 }
583
584 /**
585 * Create record header (includes the record icon, record title etc.)
586 *
587 * @param array $row Record row.
588 * @return string HTML
589 */
590 public function getRecordHeader($row)
591 {
592 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
593 $toolTip = BackendUtility::getRecordToolTip($row, 'tt_content');
594 $line = '<span ' . $toolTip . ' title="' . BackendUtility::getRecordIconAltText($row, 'tt_content') . '">' . $iconFactory->getIconForRecord('tt_content', $row, Icon::SIZE_SMALL)->render() . '</span>';
595 $line .= BackendUtility::getRecordTitle('tt_content', $row, true);
596 return $this->wrapRecordTitle($line, $row);
597 }
598
599 /**
600 * Wrapping the title of the record.
601 *
602 * @param string $str The title value.
603 * @param array $row The record row.
604 * @return string Wrapped title string.
605 */
606 public function wrapRecordTitle($str, $row)
607 {
608 return '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(['uid' => (int)$row['uid'], 'moveUid' => ''])) . '">' . $str . '</a>';
609 }
610
611 /**
612 * Returns the BackendUser
613 *
614 * @return BackendUserAuthentication
615 */
616 protected function getBackendUser()
617 {
618 return $GLOBALS['BE_USER'];
619 }
620
621 /**
622 * Returns the LanguageService
623 *
624 * @return LanguageService
625 */
626 protected function getLanguageService()
627 {
628 return $GLOBALS['LANG'];
629 }
630 }