‪TYPO3CMS  10.4
SiteTcaConfiguration.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 
20 use Symfony\Component\Finder\Finder;
21 use TYPO3\CMS\Core\Package\PackageManager;
23 
33 {
44  public function ‪getTca(): array
45  {
46  ‪$GLOBALS['SiteConfiguration'] = [];
47  $activePackages = GeneralUtility::makeInstance(PackageManager::class)->getActivePackages();
48  // First load "full table" files from Configuration/SiteConfiguration
49  ‪$finder = (new Finder())->files()->depth(0)->name('*.php');
50  $hasDirectoryEntries = false;
51  foreach ($activePackages as $package) {
52  try {
53  ‪$finder->in($package->getPackagePath() . 'Configuration/SiteConfiguration');
54  } catch (\InvalidArgumentException $e) {
55  // No such directory in this package
56  continue;
57  }
58  $hasDirectoryEntries = true;
59  }
60  if ($hasDirectoryEntries) {
61  foreach (‪$finder as $fileInfo) {
62  ‪$GLOBALS['SiteConfiguration'][substr($fileInfo->getBasename(), 0, -4)] = require $fileInfo->getPathname();
63  }
64  }
65  // Execute override files from Configuration/SiteConfiguration/Overrides
66  ‪$finder = (new Finder())->files()->depth(0)->name('*.php');
67  $hasDirectoryEntries = false;
68  foreach ($activePackages as $package) {
69  try {
70  ‪$finder->in($package->getPackagePath() . 'Configuration/SiteConfiguration/Overrides');
71  } catch (\InvalidArgumentException $e) {
72  // No such directory in this package
73  continue;
74  }
75  $hasDirectoryEntries = true;
76  }
77  if ($hasDirectoryEntries) {
78  foreach (‪$finder as $fileInfo) {
79  require $fileInfo->getPathname();
80  }
81  }
82  $result = ‪$GLOBALS['SiteConfiguration'];
83  unset(‪$GLOBALS['SiteConfiguration']);
84  return $result;
85  }
86 }
‪TYPO3\CMS\Backend\Configuration\SiteTcaConfiguration
Definition: SiteTcaConfiguration.php:33
‪$finder
‪if(PHP_SAPI !=='cli') $finder
Definition: header-comment.php:22
‪TYPO3\CMS\Backend\Configuration\SiteTcaConfiguration\getTca
‪array getTca()
Definition: SiteTcaConfiguration.php:44
‪TYPO3\CMS\Backend\Configuration
Definition: BackendUserConfiguration.php:18
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46