‪TYPO3CMS  10.4
FieldWizard.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 
37 {
45  public function ‪render(): array
46  {
47  $result = $this->‪initializeResultArray();
48  if (!isset($this->data['renderData']['fieldWizard'])) {
49  return $result;
50  }
51 
52  $fieldWizard = $this->data['renderData']['fieldWizard'];
53  $orderingService = GeneralUtility::makeInstance(DependencyOrderingService::class);
54  $orderedFieldWizard = $orderingService->orderByDependencies($fieldWizard, 'before', 'after');
55 
56  foreach ($orderedFieldWizard as $anOrderedFieldWizard => $orderedFieldWizardConfiguration) {
57  if (isset($orderedFieldWizardConfiguration['disabled']) && $orderedFieldWizardConfiguration['disabled']
58  || !isset($fieldWizard[$anOrderedFieldWizard]['renderType'])
59  ) {
60  // Don't consider this control if disabled.
61  // Also ignore if renderType is not given.
62  // Missing renderType may happen if an element registers a default field control
63  // as disabled, and TCA enabled that. If then additionally for instance the
64  // element renderType is changed to an element that doesn't register the control
65  // by default anymore, this would then fatal if we don't continue here.
66  // @todo: the above scenario indicates a small configuration flaw, maybe log an error somewhere?
67  continue;
68  }
69 
70  $options = ‪$this->data;
71  $options['renderType'] = $fieldWizard[$anOrderedFieldWizard]['renderType'];
72  $options['renderData']['fieldWizardOptions'] = $orderedFieldWizardConfiguration['options'] ?? [];
73  $wizardResult = $this->nodeFactory->create($options)->render();
74  $result = $this->‪mergeChildReturnIntoExistingResult($result, $wizardResult);
75  }
76  return $result;
77  }
78 }
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:116
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪array initializeResultArray()
Definition: AbstractNode.php:90
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:42
‪TYPO3\CMS\Core\Service\DependencyOrderingService
Definition: DependencyOrderingService.php:32
‪TYPO3\CMS\Backend\Form\NodeExpansion\FieldWizard\render
‪array render()
Definition: FieldWizard.php:45
‪TYPO3\CMS\Backend\Form\NodeExpansion
Definition: FieldControl.php:18
‪TYPO3\CMS\Backend\Form\AbstractNode
Definition: AbstractNode.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Backend\Form\NodeExpansion\FieldWizard
Definition: FieldWizard.php:37