TYPO3 CMS  TYPO3_7-6
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  $row = $this->data['databaseRow'];
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 (substr($fieldsArray[0], 0, 7) !== '--div--') {
55  array_unshift($fieldsArray, '--div--;LLL:EXT:lang/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:lang/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 (substr($field, 0, 7) === '--div--') {
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 }
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']