‪TYPO3CMS  ‪main
ListOfFieldsContainer.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 
29 {
35  public function ‪render(): array
36  {
37  $fieldListToRender = $this->data['fieldListToRender'];
38  $recordTypeValue = $this->data['recordTypeValue'];
39 
40  $fieldListToRender = array_unique(‪GeneralUtility::trimExplode(',', $fieldListToRender, true));
41 
42  $fieldsByShowitem = $this->data['processedTca']['types'][$recordTypeValue]['showitem'];
43  $fieldsByShowitem = ‪GeneralUtility::trimExplode(',', $fieldsByShowitem, true);
44 
45  $finalFieldsList = [];
46  foreach ($fieldListToRender as $fieldName) {
47  foreach ($fieldsByShowitem as $fieldByShowitem) {
48  $fieldByShowitemArray = $this->‪explodeSingleFieldShowItemConfiguration($fieldByShowitem);
49  if ($fieldByShowitemArray['fieldName'] === $fieldName) {
50  $finalFieldsList[] = implode(';', $fieldByShowitemArray);
51  break;
52  }
53  if ($fieldByShowitemArray['fieldName'] === '--palette--'
54  && isset($this->data['processedTca']['palettes'][$fieldByShowitemArray['paletteName']]['showitem'])
55  && is_string($this->data['processedTca']['palettes'][$fieldByShowitemArray['paletteName']]['showitem'])
56  ) {
57  $paletteName = $fieldByShowitemArray['paletteName'];
58  $paletteFields = ‪GeneralUtility::trimExplode(',', $this->data['processedTca']['palettes'][$paletteName]['showitem'], true);
59  foreach ($paletteFields as $paletteField) {
60  $paletteFieldArray = $this->‪explodeSingleFieldShowItemConfiguration($paletteField);
61  if ($paletteFieldArray['fieldName'] === $fieldName) {
62  $finalFieldsList[] = implode(';', $paletteFieldArray);
63  break;
64  }
65  }
66  }
67  }
68  }
69 
70  $options = ‪$this->data;
71  $options['fieldsArray'] = $finalFieldsList;
72  $options['renderType'] = 'paletteAndSingleContainer';
73  return $this->nodeFactory->create($options)->render();
74  }
75 
77  {
78  return ‪$GLOBALS['LANG'];
79  }
80 }
‪TYPO3\CMS\Backend\Form\Container
Definition: AbstractContainer.php:16
‪TYPO3\CMS\Backend\Form\Container\ListOfFieldsContainer\render
‪array render()
Definition: ListOfFieldsContainer.php:35
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\explodeSingleFieldShowItemConfiguration
‪explodeSingleFieldShowItemConfiguration(string $field)
Definition: AbstractContainer.php:107
‪TYPO3\CMS\Backend\Form\Container\ListOfFieldsContainer
Definition: ListOfFieldsContainer.php:29
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:35
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer
Definition: AbstractContainer.php:29
‪TYPO3\CMS\Backend\Form\Container\ListOfFieldsContainer\getLanguageService
‪getLanguageService()
Definition: ListOfFieldsContainer.php:76
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode
‪static list< string > trimExplode(string $delim, string $string, bool $removeEmptyValues=false, int $limit=0)
Definition: GeneralUtility.php:817