‪TYPO3CMS  9.5
SiteTcaConfiguration.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
19 use Symfony\Component\Finder\Finder;
20 use TYPO3\CMS\Core\Package\PackageManager;
22 
32 {
43  public function ‪getTca(): array
44  {
45  ‪$GLOBALS['SiteConfiguration'] = [];
46  $activePackages = GeneralUtility::makeInstance(PackageManager::class)->getActivePackages();
47  // First load "full table" files from Configuration/SiteConfiguration
48  ‪$finder = (new Finder())->files()->depth(0)->name('*.php');
49  $hasDirectoryEntries = false;
50  foreach ($activePackages as $package) {
51  try {
52  ‪$finder->in($package->getPackagePath() . 'Configuration/SiteConfiguration');
53  } catch (\InvalidArgumentException $e) {
54  // No such directory in this package
55  continue;
56  }
57  $hasDirectoryEntries = true;
58  }
59  if ($hasDirectoryEntries) {
60  foreach (‪$finder as $fileInfo) {
61  ‪$GLOBALS['SiteConfiguration'][substr($fileInfo->getBasename(), 0, -4)] = require $fileInfo->getPathname();
62  }
63  }
64  // Execute override files from Configuration/SiteConfiguration/Overrides
65  ‪$finder = (new Finder())->files()->depth(0)->name('*.php');
66  $hasDirectoryEntries = false;
67  foreach ($activePackages as $package) {
68  try {
69  ‪$finder->in($package->getPackagePath() . 'Configuration/SiteConfiguration/Overrides');
70  } catch (\InvalidArgumentException $e) {
71  // No such directory in this package
72  continue;
73  }
74  $hasDirectoryEntries = true;
75  }
76  if ($hasDirectoryEntries) {
77  foreach (‪$finder as $fileInfo) {
78  require $fileInfo->getPathname();
79  }
80  }
81  $result = ‪$GLOBALS['SiteConfiguration'];
82  unset(‪$GLOBALS['SiteConfiguration']);
83  return $result;
84  }
85 }
‪TYPO3\CMS\Backend\Configuration\SiteTcaConfiguration
Definition: SiteTcaConfiguration.php:32
‪$finder
‪$finder
Definition: annotationChecker.php:102
‪TYPO3\CMS\Backend\Configuration\SiteTcaConfiguration\getTca
‪array getTca()
Definition: SiteTcaConfiguration.php:43
‪TYPO3\CMS\Backend\Configuration
Definition: BackendUserConfiguration.php:3
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45