‪TYPO3CMS  ‪main
SitesYamlConfigurationProvider.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 Psr\EventDispatcher\EventDispatcherInterface;
24 
26 {
27  public function ‪__construct(
28  protected readonly EventDispatcherInterface $eventDispatcher,
29  protected readonly ‪SiteFinder $siteFinder
30  ) {}
31 
32  public function ‪getConfiguration(): array
33  {
34  $blindedConfigurationOptions = $this
35  ->eventDispatcher
36  ->dispatch(new ‪ModifyBlindedConfigurationOptionsEvent([], $this->identifier))
37  ->getBlindedConfigurationOptions();
38 
39  $configurationArray = [];
40  foreach ($this->siteFinder->getAllSites() as ‪$identifier => $site) {
41  $configurationArray[‪$identifier] = $site->getConfiguration();
42  if (!isset($blindedConfigurationOptions[‪$identifier])) {
43  continue;
44  }
45  ArrayUtility::mergeRecursiveWithOverrule(
46  $configurationArray[‪$identifier],
47  ArrayUtility::intersectRecursive($blindedConfigurationOptions[‪$identifier], $configurationArray[‪$identifier])
48  );
49  }
50 
51  ArrayUtility::naturalKeySortRecursive($configurationArray);
52  return $configurationArray;
53  }
54 }
‪TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\AbstractProvider\$identifier
‪string $identifier
Definition: AbstractProvider.php:28
‪TYPO3\CMS\Core\Site\SiteFinder
Definition: SiteFinder.php:31
‪TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\AbstractProvider
Definition: AbstractProvider.php:27
‪TYPO3\CMS\Lowlevel\ConfigurationModuleProvider
Definition: AbstractProvider.php:18
‪TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\SitesYamlConfigurationProvider\getConfiguration
‪getConfiguration()
Definition: SitesYamlConfigurationProvider.php:32
‪TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\SitesYamlConfigurationProvider\__construct
‪__construct(protected readonly EventDispatcherInterface $eventDispatcher, protected readonly SiteFinder $siteFinder)
Definition: SitesYamlConfigurationProvider.php:27
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:26
‪TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\SitesYamlConfigurationProvider
Definition: SitesYamlConfigurationProvider.php:26
‪TYPO3\CMS\Lowlevel\Event\ModifyBlindedConfigurationOptionsEvent
Definition: ModifyBlindedConfigurationOptionsEvent.php:25