‪TYPO3CMS  9.5
FieldWizard.php
Go to the documentation of this file.
1 <?php
2 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 
21 
35 {
43  public function ‪render(): array
44  {
45  $result = $this->‪initializeResultArray();
46  if (!isset($this->data['renderData']['fieldWizard'])) {
47  return $result;
48  }
49 
50  $fieldWizard = $this->data['renderData']['fieldWizard'];
51  $orderingService = GeneralUtility::makeInstance(DependencyOrderingService::class);
52  $orderedFieldWizard = $orderingService->orderByDependencies($fieldWizard, 'before', 'after');
53 
54  foreach ($orderedFieldWizard as $anOrderedFieldWizard => $orderedFieldWizardConfiguration) {
55  if (isset($orderedFieldWizardConfiguration['disabled']) && $orderedFieldWizardConfiguration['disabled']
56  || !isset($fieldWizard[$anOrderedFieldWizard]['renderType'])
57  ) {
58  // Don't consider this control if disabled.
59  // Also ignore if renderType is not given.
60  // Missing renderType may happen if an element registers a default field control
61  // as disabled, and TCA enabled that. If then additionally for instance the
62  // element renderType is changed to an element that doesn't register the control
63  // by default anymore, this would then fatal if we don't continue here.
64  // @todo: the above scenario indicates a small configuration flaw, maybe log an error somewhere?
65  continue;
66  }
67 
68  $options = ‪$this->data;
69  $options['renderType'] = $fieldWizard[$anOrderedFieldWizard]['renderType'];
70  $options['renderData']['fieldWizardOptions'] = $orderedFieldWizardConfiguration['options'] ?? [];
71  $wizardResult = $this->nodeFactory->create($options)->render();
72  $result = $this->‪mergeChildReturnIntoExistingResult($result, $wizardResult);
73  }
74  return $result;
75  }
76 }
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:115
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪array initializeResultArray()
Definition: AbstractNode.php:88
‪TYPO3\CMS\Backend\Form\AbstractNode\$data
‪array $data
Definition: AbstractNode.php:40
‪TYPO3\CMS\Core\Service\DependencyOrderingService
Definition: DependencyOrderingService.php:31
‪TYPO3\CMS\Backend\Form\NodeExpansion\FieldWizard\render
‪array render()
Definition: FieldWizard.php:43
‪TYPO3\CMS\Backend\Form\NodeExpansion
Definition: FieldControl.php:3
‪TYPO3\CMS\Backend\Form\AbstractNode
Definition: AbstractNode.php:27
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Form\NodeExpansion\FieldWizard
Definition: FieldWizard.php:35