‪TYPO3CMS  10.4
PageTsConfigMerged.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 
25 {
32  public function ‪addData(array $result)
33  {
34  $mergedTsConfig = $result['pageTsConfig'];
35 
36  if (empty($result['pageTsConfig']['TCEFORM.']) || !is_array($result['pageTsConfig']['TCEFORM.'])) {
37  $result['pageTsConfig'] = $mergedTsConfig;
38  return $result;
39  }
40 
41  $mergedTsConfig = $result['pageTsConfig'];
42  $type = $result['recordTypeValue'];
43  $table = $result['tableName'];
44 
45  // Merge TCEFORM.[table name].[field].types.[type] over TCEFORM.[table name].[field]
46  if (!empty($result['pageTsConfig']['TCEFORM.'][$table . '.'])
47  && is_array($result['pageTsConfig']['TCEFORM.'][$table . '.'])
48  ) {
49  foreach ($result['pageTsConfig']['TCEFORM.'][$table . '.'] as $fieldNameWithDot => $fullFieldConfiguration) {
50  $newFieldConfiguration = $fullFieldConfiguration;
51  if (!empty($fullFieldConfiguration['types.']) && is_array($fullFieldConfiguration['types.'])) {
52  $typeSpecificConfiguration = $newFieldConfiguration['types.'];
53  unset($newFieldConfiguration['types.']);
54  if (!empty($typeSpecificConfiguration[$type . '.']) && is_array($typeSpecificConfiguration[$type . '.'])) {
55  ‪ArrayUtility::mergeRecursiveWithOverrule($newFieldConfiguration, $typeSpecificConfiguration[$type . '.']);
56  }
57  }
58  $mergedTsConfig['TCEFORM.'][$table . '.'][$fieldNameWithDot] = $newFieldConfiguration;
59  }
60  }
61 
62  $result['pageTsConfig'] = $mergedTsConfig;
63 
64  return $result;
65  }
66 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfigMerged\addData
‪array addData(array $result)
Definition: PageTsConfigMerged.php:32
‪TYPO3\CMS\Core\Utility\ArrayUtility\mergeRecursiveWithOverrule
‪static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=true, $includeEmptyValues=true, $enableUnsetFeature=true)
Definition: ArrayUtility.php:654
‪TYPO3\CMS\Backend\Form\FormDataProvider
Definition: AbstractDatabaseRecordProvider.php:16
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:23
‪TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfigMerged
Definition: PageTsConfigMerged.php:25
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:24