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