‪TYPO3CMS  9.5
ConfigurationManager.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
25 {
29  protected ‪$objectManager;
30 
35 
39  protected ‪$environmentService;
40 
44  public function ‪injectObjectManager(\‪TYPO3\CMS\‪Extbase\Object\ObjectManagerInterface ‪$objectManager)
45  {
46  $this->objectManager = ‪$objectManager;
47  }
48 
52  public function ‪injectEnvironmentService(\‪TYPO3\CMS\‪Extbase\Service\EnvironmentService ‪$environmentService)
53  {
54  $this->environmentService = ‪$environmentService;
55  }
56 
60  public function ‪initializeObject()
61  {
63  }
64 
68  {
69  if ($this->environmentService->isEnvironmentInFrontendMode()) {
70  $this->concreteConfigurationManager = $this->objectManager->get(\‪TYPO3\CMS\‪Extbase\Configuration\FrontendConfigurationManager::class);
71  } else {
72  $this->concreteConfigurationManager = $this->objectManager->get(\‪TYPO3\CMS\‪Extbase\Configuration\BackendConfigurationManager::class);
73  }
74  }
75 
79  public function ‪setContentObject(\‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject = null)
80  {
81  $this->concreteConfigurationManager->setContentObject($contentObject);
82  }
83 
87  public function ‪getContentObject()
88  {
89  return $this->concreteConfigurationManager->getContentObject();
90  }
91 
98  public function ‪setConfiguration(array $configuration = [])
99  {
100  $this->concreteConfigurationManager->setConfiguration($configuration);
101  }
102 
120  public function ‪getConfiguration($configurationType, $extensionName = null, $pluginName = null)
121  {
122  switch ($configurationType) {
124  $configuration = $this->concreteConfigurationManager->getConfiguration($extensionName, $pluginName);
125  return $configuration['settings'] ?? [];
127  return $this->concreteConfigurationManager->getConfiguration($extensionName, $pluginName);
129  return $this->concreteConfigurationManager->getTypoScriptSetup();
130  default:
131  throw new \TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException('Invalid configuration type "' . $configurationType . '"', 1206031879);
132  }
133  }
134 
145  public function ‪isFeatureEnabled($featureName)
146  {
147  $configuration = $this->‪getConfiguration(self::CONFIGURATION_TYPE_FRAMEWORK);
148  return (bool)(isset($configuration['features'][$featureName]) && $configuration['features'][$featureName]);
149  }
150 }
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\getConfiguration
‪array getConfiguration($configurationType, $extensionName=null, $pluginName=null)
Definition: ConfigurationManager.php:117
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\$concreteConfigurationManager
‪TYPO3 CMS Extbase Configuration AbstractConfigurationManager $concreteConfigurationManager
Definition: ConfigurationManager.php:32
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\injectObjectManager
‪injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
Definition: ConfigurationManager.php:41
‪TYPO3
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\getContentObject
‪TYPO3 CMS Frontend ContentObject ContentObjectRenderer getContentObject()
Definition: ConfigurationManager.php:84
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:22
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\injectEnvironmentService
‪injectEnvironmentService(\TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService)
Definition: ConfigurationManager.php:49
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\setContentObject
‪setContentObject(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject=null)
Definition: ConfigurationManager.php:76
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\initializeObject
‪initializeObject()
Definition: ConfigurationManager.php:57
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\$environmentService
‪TYPO3 CMS Extbase Service EnvironmentService $environmentService
Definition: ConfigurationManager.php:36
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FRAMEWORK
‪const CONFIGURATION_TYPE_FRAMEWORK
Definition: ConfigurationManagerInterface.php:23
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager
Definition: ConfigurationManager.php:25
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\initializeConcreteConfigurationManager
‪initializeConcreteConfigurationManager()
Definition: ConfigurationManager.php:64
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\setConfiguration
‪setConfiguration(array $configuration=[])
Definition: ConfigurationManager.php:95
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FULL_TYPOSCRIPT
‪const CONFIGURATION_TYPE_FULL_TYPOSCRIPT
Definition: ConfigurationManagerInterface.php:25
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_SETTINGS
‪const CONFIGURATION_TYPE_SETTINGS
Definition: ConfigurationManagerInterface.php:24
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\$objectManager
‪TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
Definition: ConfigurationManager.php:28
‪TYPO3\CMS\Extbase\Configuration
Definition: AbstractConfigurationManager.php:2
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManager\isFeatureEnabled
‪bool isFeatureEnabled($featureName)
Definition: ConfigurationManager.php:142