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