‪TYPO3CMS  9.5
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' => !empty($fieldArray[1]) ? $fieldArray[1] : null,
98  'paletteName' => !empty($fieldArray[2]) ? $fieldArray[2] : null,
99  ];
100  }
101 
111  protected function ‪renderTabMenu(array $menuItems, $domId, $defaultTabIndex = 1)
112  {
113  $templatePath = ‪ExtensionManagementUtility::extPath('backend')
114  . 'Resources/Private/Templates/DocumentTemplate/';
115 
116  $view = GeneralUtility::makeInstance(StandaloneView::class);
117  $view->setTemplatePathAndFilename($templatePath . 'Tabs.html');
118  $view->setPartialRootPaths([$templatePath . 'Partials']);
119  $view->assignMultiple([
120  'id' => $domId,
121  'items' => $menuItems,
122  'defaultTabIndex' => $defaultTabIndex,
123  'wrapContent' => false,
124  'storeLastActiveTab' => true,
125  ]);
126  return $view->render();
127  }
128 }
‪TYPO3\CMS\Backend\Form\AbstractNode\$defaultFieldInformation
‪array $defaultFieldInformation
Definition: AbstractNode.php:46
‪TYPO3\CMS\Backend\Form\Container
Definition: AbstractContainer.php:2
‪TYPO3\CMS\Backend\Form\AbstractNode\$defaultFieldControl
‪array $defaultFieldControl
Definition: AbstractNode.php:53
‪TYPO3\CMS\Backend\Form\AbstractNode\$defaultFieldWizard
‪array $defaultFieldWizard
Definition: AbstractNode.php:60
‪TYPO3\CMS\Core\Utility\ArrayUtility\mergeRecursiveWithOverrule
‪static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=true, $includeEmptyValues=true, $enableUnsetFeature=true)
Definition: ArrayUtility.php:614
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderTabMenu
‪string renderTabMenu(array $menuItems, $domId, $defaultTabIndex=1)
Definition: AbstractContainer.php:111
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility
Definition: ExtensionManagementUtility.php:36
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\explodeSingleFieldShowItemConfiguration
‪array explodeSingleFieldShowItemConfiguration($field)
Definition: AbstractContainer.php:89
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:40
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer
Definition: AbstractContainer.php:27
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldInformation
‪array renderFieldInformation()
Definition: AbstractContainer.php:33
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:32
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:23
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldControl
‪array renderFieldControl()
Definition: AbstractContainer.php:50
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath
‪static string extPath($key, $script='')
Definition: ExtensionManagementUtility.php:149
‪TYPO3\CMS\Backend\Form\AbstractNode
Definition: AbstractNode.php:27
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldWizard
‪array renderFieldWizard()
Definition: AbstractContainer.php:67