‪TYPO3CMS  9.5
ConfigurationForm.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 
20 
27 {
31  public ‪$categories = [];
32 
37 
41  public ‪$ext_CEformName = 'tsStyleConfigForm';
42 
46  public ‪$ext_printAll = true;
47 
51  public ‪$ext_incomingValues = [];
52 
56  protected ‪$ext_realValues = [];
57 
61  public function ‪__construct(‪Context ‪$context = null)
62  {
63  parent::__construct(‪$context);
64  // Deprecate this class
65  trigger_error('Class ConfigurationForm will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
66  }
71  public function ‪ext_initTSstyleConfig($configTemplate)
72  {
73  // Do not log time-performance information
74  $this->tt_track = 0;
75  $this->constants = [$configTemplate, ''];
76  // The editable constants are returned in an array.
77  $theConstants = $this->‪generateConfig_constants();
78  return $theConstants;
79  }
80 
88  public function ‪ext_setValueArray($theConstants, $valueArray)
89  {
90  $temp = ‪$this->flatSetup;
91  $this->flatSetup = [];
92  $this->‪flattenSetup($valueArray, '');
93  $this->objReg = $this->ext_realValues = ‪$this->flatSetup;
94  $this->flatSetup = $temp;
95  foreach ($theConstants as $k => $p) {
96  if (isset($this->objReg[$k])) {
97  $theConstants[$k]['value'] = $this->ext_realValues[$k];
98  }
99  }
100  // Reset the default pool of categories.
101  $this->categories = [];
102  // The returned constants are sorted in categories, that goes into the $this->categories array
103  $this->‪ext_categorizeEditableConstants($theConstants);
104  return $theConstants;
105  }
106 
110  public function ‪ext_getCategoriesForModMenu()
111  {
112  return $this->‪ext_getCategoryLabelArray();
113  }
114 
126  public function ‪ext_getForm($cat, $theConstants, $script = '', $addFields = '', $extKey = '', $addFormTag = true)
127  {
128  $printFields = trim($this->‪ext_printFields($theConstants, $cat));
129  $content = '';
130  $content .= GeneralUtility::wrapJS('
131  function uFormUrl(aname) {
132  document.' . $this->ext_CEformName . '.action = ' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript() . '#') . '+aname;
133  }
134  ');
135  if ($addFormTag) {
136  $content .= '<form action="' . htmlspecialchars(($script ?: GeneralUtility::linkThisScript())) . '" name="' . $this->ext_CEformName . '" method="post" enctype="multipart/form-data">';
137  }
138  $content .= $addFields;
139  $content .= $printFields;
140  $content .= '<input class="btn btn-default" type="submit" name="submit" value="' . htmlspecialchars($this->‪getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_tsfe.xlf:update')) . '" id="configuration-submit-' . htmlspecialchars($extKey) . '" />';
141  return $content;
142  }
143 
150  public function ‪ext_mergeIncomingWithExisting($arr)
151  {
152  $parseObj = GeneralUtility::makeInstance(Parser\TypoScriptParser::class);
153  $parseObj->parse(implode(LF, $this->ext_incomingValues));
154  $arr2 = $parseObj->setup;
156  return $arr;
157  }
158 
163  public function ‪ext_fNandV($params)
164  {
165  $fN = 'data[' . $params['name'] . ']';
166  $idName = str_replace('.', '-', $params['name']);
167  $fV = ($params['value'] = $this->ext_realValues[$params['name']] ?? $params['default_value']);
168  $reg = [];
169  // Values entered from the constantsedit cannot be constants!
170  if (preg_match('/^\\{[\\$][a-zA-Z0-9\\.]*\\}$/', trim($fV), $reg)) {
171  $fV = '';
172  }
173  $fV = htmlspecialchars($fV);
174  return [$fN, $fV, $params, $idName];
175  }
176 
181  public function ‪ext_putValueInConf($key, $var)
182  {
183  $this->ext_incomingValues[$key] = $key . '=' . $var;
184  }
185 
189  public function ‪ext_removeValueInConf($key)
190  {
191  }
192 }
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_mergeIncomingWithExisting
‪array ext_mergeIncomingWithExisting($arr)
Definition: ConfigurationForm.php:144
‪TYPO3\CMS\Core\TypoScript\TemplateService\$context
‪Context $context
Definition: TemplateService.php:340
‪TYPO3\CMS\Core\TypoScript\TemplateService\$flatSetup
‪array $flatSetup
Definition: TemplateService.php:173
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_fNandV
‪array ext_fNandV($params)
Definition: ConfigurationForm.php:157
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\generateConfig_constants
‪array generateConfig_constants()
Definition: ExtendedTemplateService.php:298
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\$ext_CEformName
‪string $ext_CEformName
Definition: ConfigurationForm.php:38
‪TYPO3\CMS\Core\Utility\ArrayUtility\mergeRecursiveWithOverrule
‪static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=true, $includeEmptyValues=true, $enableUnsetFeature=true)
Definition: ArrayUtility.php:614
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\$ext_realValues
‪array $ext_realValues
Definition: ConfigurationForm.php:50
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService
Definition: ExtendedTemplateService.php:39
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:49
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_categorizeEditableConstants
‪ext_categorizeEditableConstants($editConstArray)
Definition: ExtendedTemplateService.php:973
‪TYPO3\CMS\Core\TypoScript
Definition: ConfigurationForm.php:2
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_removeValueInConf
‪ext_removeValueInConf($key)
Definition: ConfigurationForm.php:183
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_printFields
‪string ext_printFields($theConstants, $category)
Definition: ExtendedTemplateService.php:1073
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_putValueInConf
‪ext_putValueInConf($key, $var)
Definition: ConfigurationForm.php:175
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\getLanguageService
‪LanguageService getLanguageService()
Definition: ExtendedTemplateService.php:1566
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_setValueArray
‪array ext_setValueArray($theConstants, $valueArray)
Definition: ConfigurationForm.php:82
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_getCategoriesForModMenu
‪array ext_getCategoriesForModMenu()
Definition: ConfigurationForm.php:104
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\$categories
‪array $categories
Definition: ConfigurationForm.php:30
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\$ext_printAll
‪bool $ext_printAll
Definition: ConfigurationForm.php:42
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\$ext_incomingValues
‪array $ext_incomingValues
Definition: ConfigurationForm.php:46
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getCategoryLabelArray
‪array ext_getCategoryLabelArray()
Definition: ExtendedTemplateService.php:994
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\__construct
‪__construct(Context $context=null)
Definition: ConfigurationForm.php:55
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:23
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_getForm
‪string ext_getForm($cat, $theConstants, $script='', $addFields='', $extKey='', $addFormTag=true)
Definition: ConfigurationForm.php:120
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\$ext_dontCheckIssetValues
‪bool $ext_dontCheckIssetValues
Definition: ConfigurationForm.php:34
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_initTSstyleConfig
‪array ext_initTSstyleConfig($configTemplate)
Definition: ConfigurationForm.php:65
‪TYPO3\CMS\Core\TypoScript\TemplateService\flattenSetup
‪flattenSetup($setupArray, $prefix)
Definition: TemplateService.php:1326
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\TypoScript\ConfigurationForm
Definition: ConfigurationForm.php:27