TYPO3 CMS  TYPO3_8-7
AbstractContainer.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 
22 
26 abstract class AbstractContainer extends AbstractNode
27 {
33  protected function renderFieldInformation(): array
34  {
35  $options = $this->data;
36  $fieldInformation = $this->defaultFieldInformation;
37  $currentRenderType = $this->data['renderType'];
38  $fieldInformationFromTca = $options['processedTca']['ctrl']['container'][$currentRenderType]['fieldInformation'] ?? [];
39  ArrayUtility::mergeRecursiveWithOverrule($fieldInformation, $fieldInformationFromTca);
40  $options['renderType'] = 'fieldInformation';
41  $options['renderData']['fieldInformation'] = $fieldInformation;
42  return $this->nodeFactory->create($options)->render();
43  }
44 
50  protected function renderFieldControl(): array
51  {
52  $options = $this->data;
53  $fieldControl = $this->defaultFieldControl;
54  $currentRenderType = $this->data['renderType'];
55  $fieldControlFromTca = $options['processedTca']['ctrl']['container'][$currentRenderType]['fieldControl'] ?? [];
56  ArrayUtility::mergeRecursiveWithOverrule($fieldControl, $fieldControlFromTca);
57  $options['renderType'] = 'fieldControl';
58  $options['renderData']['fieldControl'] = $fieldControl;
59  return $this->nodeFactory->create($options)->render();
60  }
61 
67  protected function renderFieldWizard(): array
68  {
69  $options = $this->data;
70  $fieldWizard = $this->defaultFieldWizard;
71  $currentRenderType = $this->data['renderType'];
72  $fieldWizardFromTca = $options['processedTca']['ctrl']['container'][$currentRenderType]['fieldWizard'] ?? [];
73  ArrayUtility::mergeRecursiveWithOverrule($fieldWizard, $fieldWizardFromTca);
74  $options['renderType'] = 'fieldWizard';
75  $options['renderData']['fieldWizard'] = $fieldWizard;
76  return $this->nodeFactory->create($options)->render();
77  }
78 
89  protected function explodeSingleFieldShowItemConfiguration($field)
90  {
91  $fieldArray = GeneralUtility::trimExplode(';', $field);
92  if (empty($fieldArray[0])) {
93  throw new \RuntimeException('Field must not be empty', 1426448465);
94  }
95  return [
96  'fieldName' => $fieldArray[0],
97  'fieldLabel' => $fieldArray[1] ?: null,
98  'paletteName' => $fieldArray[2] ?: null,
99  ];
100  }
101 
110  protected function renderTabMenu(array $menuItems, $domId, $defaultTabIndex = 1)
111  {
112  $templatePath = ExtensionManagementUtility::extPath('backend')
113  . 'Resources/Private/Templates/DocumentTemplate/';
114 
115  $view = GeneralUtility::makeInstance(StandaloneView::class);
116  $view->setTemplatePathAndFilename($templatePath . 'Tabs.html');
117  $view->setPartialRootPaths([$templatePath . 'Partials']);
118  $view->assignMultiple([
119  'id' => $domId,
120  'items' => $menuItems,
121  'defaultTabIndex' => $defaultTabIndex,
122  'wrapContent' => false,
123  'storeLastActiveTab' => true,
124  ]);
125  return $view->render();
126  }
127 }
renderTabMenu(array $menuItems, $domId, $defaultTabIndex=1)
static trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
static makeInstance($className,... $constructorArguments)
static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=true, $includeEmptyValues=true, $enableUnsetFeature=true)