‪TYPO3CMS  ‪main
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 {
31  public function ‪addData(array $result)
32  {
33  $mergedTsConfig = $result['pageTsConfig'];
34 
35  if (empty($result['pageTsConfig']['TCEFORM.']) || !is_array($result['pageTsConfig']['TCEFORM.'])) {
36  $result['pageTsConfig'] = $mergedTsConfig;
37  return $result;
38  }
39 
40  $mergedTsConfig = $result['pageTsConfig'];
41  $type = $result['recordTypeValue'];
42  $table = $result['tableName'];
43 
44  // Merge TCEFORM.[table name].[field].types.[type] over TCEFORM.[table name].[field]
45  if (!empty($result['pageTsConfig']['TCEFORM.'][$table . '.'])
46  && is_array($result['pageTsConfig']['TCEFORM.'][$table . '.'])
47  ) {
48  foreach ($result['pageTsConfig']['TCEFORM.'][$table . '.'] as $fieldNameWithDot => $fullFieldConfiguration) {
49  $newFieldConfiguration = $fullFieldConfiguration;
50  if (!empty($fullFieldConfiguration['types.']) && is_array($fullFieldConfiguration['types.'])) {
51  $typeSpecificConfiguration = $newFieldConfiguration['types.'];
52  unset($newFieldConfiguration['types.']);
53  if (!empty($typeSpecificConfiguration[$type . '.']) && is_array($typeSpecificConfiguration[$type . '.'])) {
54  ArrayUtility::mergeRecursiveWithOverrule($newFieldConfiguration, $typeSpecificConfiguration[$type . '.']);
55  }
56  }
57  $mergedTsConfig['TCEFORM.'][$table . '.'][$fieldNameWithDot] = $newFieldConfiguration;
58  }
59  }
60 
61  $result['pageTsConfig'] = $mergedTsConfig;
62 
63  return $result;
64  }
65 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfigMerged\addData
‪array addData(array $result)
Definition: PageTsConfigMerged.php:31
‪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:26