‪TYPO3CMS  10.4
RecordsOverview.php
Go to the documentation of this file.
1 <?php
2 
3 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 
19 
27 
33 {
39  public function ‪render(): array
40  {
41  $languageService = $this->‪getLanguageService();
42  $backendUser = $this->‪getBackendUserAuthentication();
43  $result = $this->‪initializeResultArray();
44 
45  $parameterArray = $this->data['parameterArray'];
46  $config = $parameterArray['fieldConf']['config'];
47  $selectedItems = $parameterArray['itemFormElValue'];
48  $maxTitleLength = $backendUser->uc['titleLen'];
49 
50  if (!isset($config['internal_type']) || $config['internal_type'] !== 'db') {
51  // Table list makes sense on db only
52  return $result;
53  }
54 
55  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
56  $recordsOverviewHtml = [];
57  foreach ($selectedItems as $selectedItem) {
58  $title = (string)$selectedItem['title'];
59  if (empty($title)) {
60  $title = '[' . $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.no_title') . ']';
61  }
62  $shortenedTitle = GeneralUtility::fixed_lgd_cs($title, $maxTitleLength);
64  $iconFactory->getIconForRecord($selectedItem['table'], $selectedItem['row'], ‪Icon::SIZE_SMALL)->render(),
65  $selectedItem['table'],
66  $selectedItem['uid']
67  );
69  htmlspecialchars($shortenedTitle),
70  $selectedItem['table'],
71  $selectedItem['uid']
72  );
73  $recordsOverviewHtml[] = '<tr>';
74  $recordsOverviewHtml[] = '<td class="col-icon">';
75  $recordsOverviewHtml[] = $linkedIcon;
76  $recordsOverviewHtml[] = '</td>';
77  $recordsOverviewHtml[] = '<td class="col-title">';
78  $recordsOverviewHtml[] = $linkedTitle;
79  $recordsOverviewHtml[] = '<span class="text-muted">';
80  $recordsOverviewHtml[] = ' [' . $selectedItem['uid'] . ']';
81  $recordsOverviewHtml[] = '</span>';
82  $recordsOverviewHtml[] = '</td>';
83  $recordsOverviewHtml[] = '</tr>';
84  }
85 
86  $html = [];
87  if (!empty($recordsOverviewHtml)) {
88  $html[] = '<div class="table-fit">';
89  $html[] = '<table class="table table-white">';
90  $html[] = '<tbody>';
91  $html[] = implode(LF, $recordsOverviewHtml);
92  $html[] = '</tbody>';
93  $html[] = '</table>';
94  $html[] = '</div>';
95  }
96 
97  $result['html'] = implode(LF, $html);
98  return $result;
99  }
100 
104  protected function ‪getBackendUserAuthentication()
105  {
106  return ‪$GLOBALS['BE_USER'];
107  }
108 
112  protected function ‪getLanguageService()
113  {
114  return ‪$GLOBALS['LANG'];
115  }
116 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:30
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪array initializeResultArray()
Definition: AbstractNode.php:90
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview\getBackendUserAuthentication
‪BackendUserAuthentication getBackendUserAuthentication()
Definition: RecordsOverview.php:104
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:33
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapClickMenuOnIcon
‪static string wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
Definition: BackendUtility.php:2510
‪TYPO3\CMS\Backend\Form\FieldWizard
Definition: DefaultLanguageDifferences.php:18
‪TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview\render
‪array render()
Definition: RecordsOverview.php:39
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview
Definition: RecordsOverview.php:33
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Backend\Form\AbstractNode
Definition: AbstractNode.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview\getLanguageService
‪LanguageService getLanguageService()
Definition: RecordsOverview.php:112