‪TYPO3CMS  10.4
ExtensionConfigurationService.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 
22 use TYPO3\CMS\Core\Package\PackageManager;
24 
36 {
40  private ‪$packageManager;
41 
46 
47  public function ‪__construct(
48  PackageManager ‪$packageManager,
50  ) {
51  $this->packageManager = ‪$packageManager;
52  $this->configurationParser = ‪$configurationParser;
53  }
61  public function ‪getConfigurationPreparedForView(string $extensionKey): array
62  {
63  $package = $this->packageManager->getPackage($extensionKey);
64  if (!@is_file($package->getPackagePath() . 'ext_conf_template.txt')) {
65  return [];
66  }
67  $extensionConfiguration = new ExtensionConfiguration();
68  $rawConfiguration = $extensionConfiguration->getDefaultConfigurationRawString($extensionKey);
69  $configuration = $this->configurationParser->getConfigurationAsValuedArray($rawConfiguration);
70  foreach ($configuration as $configurationPath => &$details) {
71  try {
72  $configuration[$configurationPath]['extensionKey'] = $extensionKey;
73  $valueFromLocalConfiguration = $extensionConfiguration->get($extensionKey, str_replace('.', '/', $configurationPath));
74  $details['value'] = $valueFromLocalConfiguration;
75  } catch (ExtensionConfigurationPathDoesNotExistException $e) {
76  // Deliberately empty - it can happen at runtime that a written config does not return
77  // back all values (eg. saltedpassword with its userFuncs), which then miss in the written
78  // configuration and are only synced after next install tool run. This edge case is
79  // taken care of here.
80  }
81  }
82  return $this->configurationParser->prepareConfigurationForView($configuration);
83  }
84 }
‪TYPO3\CMS\Install\Service\ExtensionConfigurationService\__construct
‪__construct(PackageManager $packageManager, ConstantConfigurationParser $configurationParser)
Definition: ExtensionConfigurationService.php:45
‪TYPO3\CMS\Install\Service\ExtensionConfigurationService\$configurationParser
‪ConstantConfigurationParser $configurationParser
Definition: ExtensionConfigurationService.php:43
‪TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException
Definition: ExtensionConfigurationPathDoesNotExistException.php:27
‪TYPO3\CMS\Core\Configuration\ExtensionConfiguration
Definition: ExtensionConfiguration.php:45
‪TYPO3\CMS\Install\Service\ExtensionConfigurationService
Definition: ExtensionConfigurationService.php:36
‪TYPO3\CMS\Install\Service\ExtensionConfigurationService\getConfigurationPreparedForView
‪array getConfigurationPreparedForView(string $extensionKey)
Definition: ExtensionConfigurationService.php:59
‪TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser
Definition: ConstantConfigurationParser.php:34
‪TYPO3\CMS\Install\Service\ExtensionConfigurationService\$packageManager
‪PackageManager $packageManager
Definition: ExtensionConfigurationService.php:39
‪TYPO3\CMS\Install\Service
Definition: ClearCacheService.php:16