‪TYPO3CMS  9.5
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:core/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 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:29
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪array initializeResultArray()
Definition: AbstractNode.php:88
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:25
‪TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview\getBackendUserAuthentication
‪BackendUserAuthentication getBackendUserAuthentication()
Definition: RecordsOverview.php:102
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:31
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapClickMenuOnIcon
‪static string wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
Definition: BackendUtility.php:2759
‪TYPO3\CMS\Backend\Form\FieldWizard
Definition: DefaultLanguageDifferences.php:3
‪TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview\render
‪array render()
Definition: RecordsOverview.php:37
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:45
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview
Definition: RecordsOverview.php:31
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Backend\Form\AbstractNode
Definition: AbstractNode.php:27
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview\getLanguageService
‪LanguageService getLanguageService()
Definition: RecordsOverview.php:110