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