‪TYPO3CMS  11.5
SelectOptionsExtractor.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 
22 
27 {
33  public function ‪__invoke(string $_, $value, array $matches)
34  {
35  [, $formElementType, $formEditorIndex] = $matches;
36 
37  $templateName = ‪ArrayUtility::getValueByPath(
38  $this->extractorDto->getPrototypeConfiguration(),
39  implode(
40  '.',
41  [
42  'formElementsDefinition',
43  $formElementType,
44  'formEditor',
45  'editors',
46  $formEditorIndex,
47  'templateName',
48  ]
49  ),
50  '.'
51  );
52 
53  if ($templateName === 'Inspector-FinishersEditor') {
54  $propertyPath = '_finishers';
55  } elseif ($templateName === 'Inspector-ValidatorsEditor') {
56  $propertyPath = '_validators';
57  } else {
58  if ($templateName === 'Inspector-RequiredValidatorEditor') {
59  $propertyPath = implode(
60  '.',
61  [
62  'formElementsDefinition',
63  $formElementType,
64  'formEditor',
65  'editors',
66  $formEditorIndex,
67  'configurationOptions',
68  'validationErrorMessage',
69  'propertyPath',
70  ]
71  );
72  } else {
73  $propertyPath = implode(
74  '.',
75  [
76  'formElementsDefinition',
77  $formElementType,
78  'formEditor',
79  'editors',
80  $formEditorIndex,
81  'propertyPath',
82  ]
83  );
84  }
85 
86  $propertyPath = ‪ArrayUtility::getValueByPath(
87  $this->extractorDto->getPrototypeConfiguration(),
88  $propertyPath,
89  '.'
90  );
91  }
92 
93  $result = $this->extractorDto->getResult();
94  $result['formElements'][$formElementType]['selectOptions'][$propertyPath][] = $value;
95  $this->extractorDto->setResult($result);
96  }
97 }
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\SelectOptionsExtractor\__invoke
‪__invoke(string $_, $value, array $matches)
Definition: SelectOptionsExtractor.php:33
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\AbstractExtractor
Definition: AbstractExtractor.php:24
‪TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath
‪static mixed getValueByPath(array $array, $path, $delimiter='/')
Definition: ArrayUtility.php:180
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement
Definition: IsCreatableFormElementExtractor.php:18
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\SelectOptionsExtractor
Definition: SelectOptionsExtractor.php:27
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:24