|
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
|
|
|
|
|
18
|
|
|
namespace TYPO3\CMS\IndexedSearch\Hook; |
|
19
|
|
|
|
|
20
|
|
|
use TYPO3\CMS\Core\Imaging\IconFactory; |
|
21
|
|
|
use TYPO3\CMS\Core\Localization\LanguageService; |
|
22
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @internal This class is a hook implementation and is not part of the TYPO3 Core API. |
|
26
|
|
|
*/ |
|
27
|
|
|
class AvailableTcaTables |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* itemsProcFunc for adding all available TCA tables |
|
31
|
|
|
* |
|
32
|
|
|
* @param array $fieldDefinition |
|
33
|
|
|
*/ |
|
34
|
|
|
public function populateTables(array &$fieldDefinition): void |
|
35
|
|
|
{ |
|
36
|
|
|
$iconFactory = GeneralUtility::makeInstance(IconFactory::class); |
|
37
|
|
|
$languageService = $this->getLanguageService(); |
|
38
|
|
|
|
|
39
|
|
|
foreach ($GLOBALS['TCA'] as $tableName => $tableConfiguration) { |
|
40
|
|
|
if ($tableConfiguration['ctrl']['adminOnly'] ?? false) { |
|
41
|
|
|
// Hide "admin only" tables |
|
42
|
|
|
continue; |
|
43
|
|
|
} |
|
44
|
|
|
$label = ($tableConfiguration['ctrl']['title'] ?? '') ?: ''; |
|
45
|
|
|
$icon = $iconFactory->mapRecordTypeToIconIdentifier($tableName, []); |
|
46
|
|
|
$languageService->loadSingleTableDescription($tableName); |
|
47
|
|
|
$helpText = (string)($GLOBALS['TCA_DESCR'][$tableName]['columns']['']['description'] ?? ''); |
|
48
|
|
|
$fieldDefinition['items'][] = [$label, $tableName, $icon, null, $helpText]; |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
protected function getLanguageService(): LanguageService |
|
53
|
|
|
{ |
|
54
|
|
|
return $GLOBALS['LANG']; |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|