‪TYPO3CMS  9.5
FullRecordContainer.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 
19 
29 {
35  public function ‪render()
36  {
37  $table = $this->data['tableName'];
38  $recordTypeValue = $this->data['recordTypeValue'];
39 
40  // Load the description content for the table if requested
41  if (!empty($this->data['processedTca']['interface']['always_description'])) {
42  $languageService = $this->‪getLanguageService();
43  $languageService->loadSingleTableDescription($table);
44  }
45 
46  // List of items to be rendered
47  $itemList = $this->data['processedTca']['types'][$recordTypeValue]['showitem'];
48 
49  $fieldsArray = GeneralUtility::trimExplode(',', $itemList, true);
50 
51  // Streamline the fields array
52  // First, make sure there is always a --div-- definition for the first element
53  if (strpos($fieldsArray[0], '--div--') !== 0) {
54  array_unshift($fieldsArray, '--div--;LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.generalTab');
55  }
56  // If first tab has no label definition, add "general" label
57  $firstTabHasLabel = count(GeneralUtility::trimExplode(';', $fieldsArray[0])) > 1;
58  if (!$firstTabHasLabel) {
59  $fieldsArray[0] = '--div--;LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.generalTab';
60  }
61  // If there are at least two --div-- definitions, inner container will be a TabContainer, else a NoTabContainer
62  $tabCount = 0;
63  foreach ($fieldsArray as $field) {
64  if (strpos($field, '--div--') === 0) {
65  $tabCount++;
66  }
67  }
68  $hasTabs = true;
69  if ($tabCount < 2) {
70  // Remove first tab definition again if there is only one tab defined
71  array_shift($fieldsArray);
72  $hasTabs = false;
73  }
74 
76  ‪$data['fieldsArray'] = $fieldsArray;
77  if ($hasTabs) {
78  ‪$data['renderType'] = 'tabsContainer';
79  } else {
80  ‪$data['renderType'] = 'noTabsContainer';
81  }
82 
83  return $this->nodeFactory->create(‪$data)->render();
84  }
85 
89  protected function ‪getLanguageService()
90  {
91  return ‪$GLOBALS['LANG'];
92  }
93 }
‪TYPO3\CMS\Backend\Form\Container\FullRecordContainer\getLanguageService
‪LanguageService getLanguageService()
Definition: FullRecordContainer.php:89
‪TYPO3\CMS\Backend\Form\Container
Definition: AbstractContainer.php:2
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:40
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer
Definition: AbstractContainer.php:27
‪TYPO3\CMS\Backend\Form\Container\FullRecordContainer\render
‪array render()
Definition: FullRecordContainer.php:35
‪TYPO3\CMS\Backend\Form\Container\FullRecordContainer
Definition: FullRecordContainer.php:29
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45