TYPO3 CMS  TYPO3_8-7
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 (substr($fieldsArray[0], 0, 7) !== '--div--') {
54  array_unshift($fieldsArray, '--div--;LLL:EXT:lang/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:lang/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 (substr($field, 0, 7) === '--div--') {
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 }
static trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']