TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
form/Classes/Mvc/Configuration/TypoScriptService.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Form\Mvc\Configuration;
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 
26 {
27 
32 
37  public function injectTypoScriptService(\TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService)
38  {
39  $this->extbaseTypoScriptService = $typoScriptService;
40  }
41 
50  public function resolvePossibleTypoScriptConfiguration(array $configuration = []): array
51  {
52  $configuration = $this->extbaseTypoScriptService->convertPlainArrayToTypoScriptArray($configuration);
53  $configuration = $this->resolveTypoScriptConfiguration($configuration);
54  $configuration = $this->extbaseTypoScriptService->convertTypoScriptArrayToPlainArray($configuration);
55  return $configuration;
56  }
57 
74  protected function resolveTypoScriptConfiguration(array $configuration = []): array
75  {
76  foreach ($configuration as $key => $value) {
77  $keyWithoutDot = rtrim((string)$key, '.');
78  if (isset($configuration[$keyWithoutDot]) && isset($configuration[$keyWithoutDot . '.'])) {
79  $value = $this->getTypoScriptFrontendController()->cObj->cObjGetSingle(
80  $configuration[$keyWithoutDot],
81  $configuration[$keyWithoutDot . '.']
82  );
83  $configuration[$keyWithoutDot] = $value;
84  } elseif (!isset($configuration[$keyWithoutDot]) && isset($configuration[$keyWithoutDot . '.'])) {
85  $configuration[$keyWithoutDot] = $this->resolveTypoScriptConfiguration($value);
86  }
87  unset($configuration[$keyWithoutDot . '.']);
88  }
89  return $configuration;
90  }
91 
95  protected function getTypoScriptFrontendController()
96  {
97  return $GLOBALS['TSFE'];
98  }
99 }
injectTypoScriptService(\TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService)
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']