‪TYPO3CMS  10.4
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()
36  {
37  $table = $this->data['tableName'];
38  $fieldListToRender = $this->data['fieldListToRender'];
39  $recordTypeValue = $this->data['recordTypeValue'];
40 
41  // Load the description content for the table if requested
42  if (!empty(‪$GLOBALS['TCA'][$table]['interface']['always_description'])) {
43  $languageService = $this->‪getLanguageService();
44  $languageService->loadSingleTableDescription($table);
45  }
46 
47  $fieldListToRender = array_unique(‪GeneralUtility::trimExplode(',', $fieldListToRender, true));
48 
49  $fieldsByShowitem = $this->data['processedTca']['types'][$recordTypeValue]['showitem'];
50  $fieldsByShowitem = ‪GeneralUtility::trimExplode(',', $fieldsByShowitem, true);
51 
52  $finalFieldsList = [];
53  foreach ($fieldListToRender as $fieldName) {
54  foreach ($fieldsByShowitem as $fieldByShowitem) {
55  $fieldByShowitemArray = $this->‪explodeSingleFieldShowItemConfiguration($fieldByShowitem);
56  if ($fieldByShowitemArray['fieldName'] === $fieldName) {
57  $finalFieldsList[] = implode(';', $fieldByShowitemArray);
58  break;
59  }
60  if ($fieldByShowitemArray['fieldName'] === '--palette--'
61  && isset($this->data['processedTca']['palettes'][$fieldByShowitemArray['paletteName']]['showitem'])
62  && is_string($this->data['processedTca']['palettes'][$fieldByShowitemArray['paletteName']]['showitem'])
63  ) {
64  $paletteName = $fieldByShowitemArray['paletteName'];
65  $paletteFields = ‪GeneralUtility::trimExplode(',', $this->data['processedTca']['palettes'][$paletteName]['showitem'], true);
66  foreach ($paletteFields as $paletteField) {
67  $paletteFieldArray = $this->‪explodeSingleFieldShowItemConfiguration($paletteField);
68  if ($paletteFieldArray['fieldName'] === $fieldName) {
69  $finalFieldsList[] = implode(';', $paletteFieldArray);
70  break;
71  }
72  }
73  }
74  }
75  }
76 
77  $options = ‪$this->data;
78  $options['fieldsArray'] = $finalFieldsList;
79  $options['renderType'] = 'paletteAndSingleContainer';
80  return $this->nodeFactory->create($options)->render();
81  }
82 
86  protected function ‪getLanguageService()
87  {
88  return ‪$GLOBALS['LANG'];
89  }
90 }
‪TYPO3\CMS\Backend\Form\Container\ListOfFieldsContainer\getLanguageService
‪LanguageService getLanguageService()
Definition: ListOfFieldsContainer.php:86
‪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\ListOfFieldsContainer
Definition: ListOfFieldsContainer.php:29
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\explodeSingleFieldShowItemConfiguration
‪array explodeSingleFieldShowItemConfiguration($field)
Definition: AbstractContainer.php:90
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:42
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer
Definition: AbstractContainer.php:28
‪TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode
‪static string[] trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:1059
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46