TYPO3 CMS  TYPO3_8-7
RecordsOverview.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
25 
31 {
37  public function render(): array
38  {
39  $languageService = $this->getLanguageService();
40  $backendUser = $this->getBackendUserAuthentication();
41  $result = $this->initializeResultArray();
42 
43  $parameterArray = $this->data['parameterArray'];
44  $config = $parameterArray['fieldConf']['config'];
45  $selectedItems = $parameterArray['itemFormElValue'];
46  $maxTitleLength = $backendUser->uc['titleLen'];
47 
48  if (!isset($config['internal_type']) || $config['internal_type'] !== 'db') {
49  // Table list makes sense on db only
50  return $result;
51  }
52 
53  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
54  $recordsOverviewHtml = [];
55  foreach ($selectedItems as $selectedItem) {
56  $title = (string)$selectedItem['title'];
57  if (empty($title)) {
58  $title = '[' . $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.no_title') . ']';
59  }
60  $shortenedTitle = GeneralUtility::fixed_lgd_cs($title, $maxTitleLength);
62  $iconFactory->getIconForRecord($selectedItem['table'], $selectedItem['row'], Icon::SIZE_SMALL)->render(),
63  $selectedItem['table'],
64  $selectedItem['uid']
65  );
67  htmlspecialchars($shortenedTitle),
68  $selectedItem['table'],
69  $selectedItem['uid']
70  );
71  $recordsOverviewHtml[] = '<tr>';
72  $recordsOverviewHtml[] = '<td class="col-icon">';
73  $recordsOverviewHtml[] = $linkedIcon;
74  $recordsOverviewHtml[] = '</td>';
75  $recordsOverviewHtml[] = '<td class="col-title">';
76  $recordsOverviewHtml[] = $linkedTitle;
77  $recordsOverviewHtml[] = '<span class="text-muted">';
78  $recordsOverviewHtml[] = ' [' . $selectedItem['uid'] . ']';
79  $recordsOverviewHtml[] = '</span>';
80  $recordsOverviewHtml[] = '</td>';
81  $recordsOverviewHtml[] = '</tr>';
82  }
83 
84  $html = [];
85  if (!empty($recordsOverviewHtml)) {
86  $html[] = '<div class="table-fit">';
87  $html[] = '<table class="table table-white">';
88  $html[] = '<tbody>';
89  $html[] = implode(LF, $recordsOverviewHtml);
90  $html[] = '</tbody>';
91  $html[] = '</table>';
92  $html[] = '</div>';
93  }
94 
95  $result['html'] = implode(LF, $html);
96  return $result;
97  }
98 
102  protected function getBackendUserAuthentication()
103  {
104  return $GLOBALS['BE_USER'];
105  }
106 
110  protected function getLanguageService()
111  {
112  return $GLOBALS['LANG'];
113  }
114 }
static wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
static makeInstance($className,... $constructorArguments)
static fixed_lgd_cs($string, $chars, $appendString='...')
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']